mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Replacing Contents of HtmlBlock / HtmlInline #505
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 @damageboy on GitHub (Feb 27, 2022).
Hi,
I'm looking for a cookbook like recipe for how is the "right" way, as far as markdig is concerned for doing markdown transformations.
Namely, I'm trying to concert a
.mdfile to a.mdxfile using markdig.One of the relatively minor challenges in this process is converting
style="a: b;c: d"html attributes tostyle={{a: b, c: d}}.Generally speaking, making such changes in a "living" MarkdownDoc class is not very well documented, or I'm just reading the wrong documents.
Could anyone chart the path of least resistance when it comes to such challenges?
@xoofx commented on GitHub (Mar 1, 2022):
It depends on what you want to do. If it is to re-emit markdown documents or to still transform it to a pseudo-HTML content? The later is usually the easiest.
But the former, depending on your processing need, can be done by processing Markdown syntax tree via e.g MarkdownObject.Descendants
If you need to write a different output, you might have to write a custom renderer or you can overwrite an existing one (e.g HtmlRenderer). You can see the code here and despite the lack of doc, it should not be too difficult to figure out how to write a new one or overwrite a new one.