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

How to render back to markdown? #670

Open
jcorbin opened this issue Jun 26, 2020 · 4 comments
Open

How to render back to markdown? #670

jcorbin opened this issue Jun 26, 2020 · 4 comments
Labels

Comments

@jcorbin
Copy link

jcorbin commented Jun 26, 2020

Trying to write a program that's mostly an AST transformer, but I can't seem to find any way to turn a (v2) node back into markdown text ( short of writing my own markdown renderer that is, which I'd like to avoid? or at worst, contribute to the library, rather than maintain in my project? )

@dmitshur
Copy link
Collaborator

dmitshur commented Oct 5, 2020

You might find https://github.com/jsternberg/markdownfmt to be relevant.

@inliquid
Copy link

@suessflorian
Copy link

Is there an answer for this? I'm also keen to render a blackfriday.Node back to markdown.

@Vaelatern
Copy link

I imported github.com/jsternberg/markdownfmt/markdown and used it as here: https://github.com/Vaelatern/mdbook-d2-go/blob/ace29af66b63df6f54abc66973104b49bb0d6c4f/main.go#L186-L192 to go from blackfriday's AST back to markdown

also pictured, an example of mutating an AST before returning it to markdown.

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

No branches or pull requests

5 participants