markdown
markdown copied to clipboard
Serializing to markdown
This package parses markdown strings into an AST. Is this package intended to offer a path in the reverse, to serialize markdown structure to a string?
If it is, can someone add an example to the README?
If not, can that ability be added? Or, would it make sense to extract the AST from this package into a more core package and adjust the API to make such a thing possible?
I'm using this package to parse markdown into my own document structure. I also need to support serialization from my document structure to a markdown string. Currently I'm doing that by hand.
Not yet. I just wrote a proof-of-concept for what you are describing, and hope to implement it this Spring. :D :D :D
The original markers are removed when parsing markdown strings into AST structure, it means there are no markers stored in AST nodes. So maybe it is impossible to reverse with current Element model.
I am going to enhance the AST structure in the coming few weeks, the enhanced AST structure will save the markdown markers which will make it possible to reverse AST structure to it's original markdown string or to beautify markdown string. Also it will be possible to render markdown string to WYSIWYM markdown editor input with the markers highlighted etc.
Do you plan to add an easy/clean way to update the AST structure (inserting/deleting nodes...) ? (probably part of a new issue but this one is presumably required before)
@RichardFevrier Yep, maybe you could create an new issue to describe the requirement in detail?