Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializing to markdown #364

Open
matthew-carroll opened this issue Apr 1, 2021 · 5 comments
Open

Serializing to markdown #364

matthew-carroll opened this issue Apr 1, 2021 · 5 comments

Comments

@matthew-carroll
Copy link

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.

@srawlins
Copy link
Member

srawlins commented Apr 1, 2021

Not yet. I just wrote a proof-of-concept for what you are describing, and hope to implement it this Spring. :D :D :D

@chenzhiguang
Copy link
Contributor

chenzhiguang commented Mar 25, 2022

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.

@chenzhiguang
Copy link
Contributor

chenzhiguang commented Apr 6, 2022

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.

@RichardFevrier
Copy link

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)

@chenzhiguang
Copy link
Contributor

@RichardFevrier Yep, maybe you could create an new issue to describe the requirement in detail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants