Question: Non HTML Output #112

Closed
opened 2026-01-29 14:27:20 +00:00 by claunia · 2 comments
Owner

Originally created by @wmansfield on GitHub (May 13, 2017).

Before I dig (ha) into this, I'd like to know if its possible to use this to parse MarkDown and generate a custom representation that is not html. (a custom XML that describes the content). I'd like to essentially create a translation from markdown to a custom 3rd party format.

Originally created by @wmansfield on GitHub (May 13, 2017). Before I dig (ha) into this, I'd like to know if its possible to use this to parse MarkDown and generate a custom representation that is not html. (a custom XML that describes the content). I'd like to essentially create a translation from markdown to a custom 3rd party format.
claunia added the question label 2026-01-29 14:27:20 +00:00
Author
Owner

@xoofx commented on GitHub (May 14, 2017):

As you have access to a full AST/syntax model, sure you can query and generate anything from it.

Using the Markdown.Parse that returns directly a MarkdownDocument object

Or using the Markdown.Convert which is working with a IMarkdownRenderer (e.g The HtmlRenderer is an implementation used for rendering to HTML)

Note that a Markdown AST can still contains HTML syntax node (like for entities & or because Markdown allows to have HTML blocks...)

@xoofx commented on GitHub (May 14, 2017): As you have access to a full AST/syntax model, sure you can query and generate anything from it. Using the [`Markdown.Parse`](https://github.com/lunet-io/markdig/blob/762196f03b110709fa8906ad2944083f036f8471/src/Markdig/Markdown.cs#L104) that returns directly a `MarkdownDocument` object Or using the [`Markdown.Convert`](https://github.com/lunet-io/markdig/blob/762196f03b110709fa8906ad2944083f036f8471/src/Markdig/Markdown.cs#L73) which is working with a `IMarkdownRenderer` (e.g The HtmlRenderer is an implementation used for rendering to HTML) Note that a Markdown AST can still contains HTML syntax node (like for entities `&` or because Markdown allows to have HTML blocks...)
Author
Owner

@wmansfield commented on GitHub (May 15, 2017):

Thanks for the response. I didn't want to get excited and jump in just to discover a subtle flaw. I'm on it!

@wmansfield commented on GitHub (May 15, 2017): Thanks for the response. I didn't want to get excited and jump in just to discover a subtle flaw. I'm on it!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#112