markdig icon indicating copy to clipboard operation
markdig copied to clipboard

Serialize MarkdownDocument to XML?

Open wadimw opened this issue 3 years ago • 1 comments

Hi,

I'm looking for a way to safely translate existing Markdown documents without risking syntax issues introduced by human error. It seems that your roundtrip support would be perfect for this - in essence, I've been thinking of parsing the document in question with markdig and localizing only selected strings within the AST. That would alleviate the risk of someone accidentally deleting emphasis, inserting an empty line or deleting some significant HTML comment etc.

Translation itself would need to be performed in some other designated system, so I would need to output the generated document tree to some other format and deserialize it afterwards. Do You think it would be possible to serialize an AST of MarkdownDocument into an XML file?

wadimw avatar Feb 23 '22 17:02 wadimw

I doubt the syntax tree will serialize/deserialize well.

A simpler approach may be extracting the strings you are interested in from the AST and only serializing the string => string translation mappings.

MihaZupan avatar Feb 27 '22 21:02 MihaZupan