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

Add support for serializing math nodes as markdown #148

Merged
merged 8 commits into from
Oct 11, 2024

Conversation

bnchi
Copy link
Contributor

@bnchi bnchi commented Oct 9, 2024

Adds support for serializing math nodes in mdast_util_to_markdown

TODO :

  • Add support for inline math and complete the tests

@bnchi
Copy link
Contributor Author

bnchi commented Oct 9, 2024

@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
Copy link
Owner

wooorm commented Oct 10, 2024

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 bnchi marked this pull request as ready for review October 11, 2024 10:52
@bnchi bnchi changed the title Add support for serializing math nodes in mdast_util_to_markdown Add support for serializing math nodes as markdown Oct 11, 2024
mdast_util_to_markdown/src/configure.rs Outdated Show resolved Hide resolved
mdast_util_to_markdown/src/construct_name.rs Outdated Show resolved Hide resolved
mdast_util_to_markdown/src/handle/root.rs Outdated Show resolved Hide resolved
@bnchi bnchi requested a review from wooorm October 11, 2024 12:38
Copy link
Owner

@wooorm wooorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a small nit on docs :)

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

mdast_util_to_markdown/src/configure.rs Outdated Show resolved Hide resolved
mdast_util_to_markdown/src/configure.rs Outdated Show resolved Hide resolved
@bnchi
Copy link
Contributor Author

bnchi commented Oct 11, 2024

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 wooorm merged commit 9ed45b4 into wooorm:main Oct 11, 2024
3 checks passed
@wooorm
Copy link
Owner

wooorm commented Oct 11, 2024

Super, thank you! 👏

@SamPeng87
Copy link

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

@bnchi
Copy link
Contributor Author

bnchi commented Oct 22, 2024

@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
Copy link

@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。

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

Successfully merging this pull request may close these issues.

3 participants