mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-09 21:42:15 +00:00
Question: Is it possible to get Updated Markdown text from MarkdownDocument? #203
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 @RickStrahl on GitHub (Apr 21, 2018).
I see that I can render a syntax tree to HTML, but diggning throgh the code I'm not seeing if there's a way to get Markdown back out after making changes to the sytnax tree.
Scenario:
I'm basically looking through a Markdown document and need to fix up a few links and images - so I iterate through the document and make changes to the inlines to fix up the links/images on MarkdownDocument. Parsing and updating works beautifully.
But I can't seem to find a way to now get back Markdown text from this. Should this be possible or am I just missing it?
@xoofx commented on GitHub (Apr 22, 2018):
There is an ongoing work called "normalize" which is usable here from Markdown class directly (or via the NormalizeRenderer)
But it is a work in progress, it doesn't strictly support round trip, it is missing a few stuffs, it doesn't cover extensions for now...etc.
@xoofx commented on GitHub (Apr 22, 2018):
The issue #155 is following a bit this work (but I have personally no more time to work on this)
@pauldotknopf commented on GitHub (May 6, 2018):
@RickStrahl, it looks like I am doing something similar in #225.
I'm trying to create a custom renderer that simply passes the raw markdown to a new markdown content, with the option to override certain block items.
To me, it seems like it would be easier to instead of modifying the syntax tree directly, implement a custom renderer that transforms the input markdown into new markdown, that you could re-parse.
In your case, you would provide your own
MarkdownObjectRendererfor aLinkInlineto transform the markdown into anything else.