[Question] How conver MarkdownDocument back to markdown #184

Closed
opened 2026-01-29 14:29:42 +00:00 by claunia · 1 comment
Owner

Originally created by @LSTANCZYK on GitHub (Jan 23, 2018).

I have MarkdownDocument instance and want to convert it back to markdown text after my document manipulation. How can i do that?

Originally created by @LSTANCZYK on GitHub (Jan 23, 2018). I have MarkdownDocument instance and want to convert it back to markdown text after my document manipulation. How can i do that?
claunia added the question label 2026-01-29 14:29:42 +00:00
Author
Owner

@xoofx commented on GitHub (Jan 25, 2018):

You can use the NormalizeRenderer as it is used in Markdown.Normalize:

eedfc3cd9c/src/Markdig/Markdown.cs (L54-L59)

You have a call to a Parse method here, but you reusing your own MarkdownDocument, you can call then renderer yourself.

Note that saving back to MarkdownDocument supports mainly core CommonMark and very vew Markdig extensions (see #155)

@xoofx commented on GitHub (Jan 25, 2018): You can use the NormalizeRenderer as it is used in Markdown.Normalize: https://github.com/lunet-io/markdig/blob/eedfc3cd9cc4b8ccfa66d31fe401f0cc5b9582b6/src/Markdig/Markdown.cs#L54-L59 You have a call to a Parse method here, but you reusing your own MarkdownDocument, you can call then renderer yourself. Note that saving back to MarkdownDocument supports mainly core CommonMark and very vew Markdig extensions (see #155)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#184