wooorm / markdown-rs

CommonMark compliant markdown parser in Rust with ASTs and extensions
https://docs.rs/markdown/1.0.0-alpha.21/markdown/
MIT License
966 stars 53 forks source link

Add support for serializing math nodes as markdown #148

Closed bnchi closed 1 month ago

bnchi commented 1 month ago

Adds support for serializing math nodes in mdast_util_to_markdown

TODO :

bnchi commented 1 month ago

@wooorm I made this a draft to get your opinion on how we're going to be serializing the extensions should we do any special way in the API by allowing the user to configure the extension or no. This draft doesn't allow the user to configure the extension and we serialize the extensions nodes in a "normal" way.

wooorm commented 1 month ago

should we do any special way in the API by allowing the user to configure the extension or no

No, I don’t think so. I think it’s good to always serialize nodes, if we understand them!

bnchi commented 1 month ago

Otherwise, I think it’s good? You? Anything in particular you wanted me to look at?

No, all good.

I'll probably work on the mdx nodes next. Thank you :)

wooorm commented 1 month ago

Super, thank you! 👏

SamPeng87 commented 1 month ago

so,I think that to_markdown api has need some time to used?thanks that pr,I need that feature too

bnchi commented 1 month ago

@SamPeng87 It's usable but it needs some documentations and most likely a release into the registry, for now you can add the following to your Cargo.toml and use it :

[dependencies]
mdast_util_to_markdown = { git = "https://github.com/wooorm/markdown-rs.git" }

The api is pretty simple just have a look at the exposed functions here : https://github.com/wooorm/markdown-rs/blob/main/mdast_util_to_markdown/src/lib.rs

SamPeng87 commented 1 month ago

@bnchi yes,thanks,I found that there was no document to tell me how to use it, but I found that there was in master branch, so I just studied the latest master of github master branch instead of crate.io。that work。thanks you。