mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Obtain HTML for Markdown fragments? #561
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pm64 on GitHub (Sep 19, 2022).
I'm new to this API, so please accept my apologies in advance for what is likely a dumb question.
I'm trying to use Markdig to generate just the HTML corresponding to individual sections of Markdown that are part of a larger document.
For example, given the input string "hello *this* is a test", I want to receive "hello ", "<em>this</em>", and " is a test" (or similar) as separate HTML fragments, each of which can be correlated back to the corresponding Markdown fragment ("hello ", "*this*", and " is a test", respectively). Is something like that possible?
@MihaZupan commented on GitHub (Sep 19, 2022):
Here's a sample that should let you get started
This will print
Notice
<em>this</em>andthison separate lines - this is becauseEmphasisInlinecontains theLiteralInlineas a child node.Take a look at https://github.com/xoofx/markdig/blob/master/doc/parsing-ast.md for some info about how to deal with the AST.
@pm64 commented on GitHub (Sep 19, 2022):
@MihaZupan, this is exactly what I was looking for. Immensely appreciate all you do, thank you!