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

Compile mdast to html #101

Closed
GuillaumeDesforges opened this issue Jan 22, 2024 · 4 comments
Closed

Compile mdast to html #101

GuillaumeDesforges opened this issue Jan 22, 2024 · 4 comments
Labels
duplicate This issue or pull request already exists

Comments

@GuillaumeDesforges
Copy link

I'd like to manipulate the parsed AST before it goes through compilation.

I can get the AST using to_mdast, however I can't then compile it to HTML as to_html::compile is private in the crate.

@ChristianMurphy
Copy link
Collaborator

Duplicate of #32

@ChristianMurphy ChristianMurphy marked this as a duplicate of #32 Jan 22, 2024
@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
@ChristianMurphy ChristianMurphy added the duplicate This issue or pull request already exists label Jan 22, 2024
@GuillaumeDesforges
Copy link
Author

@ChristianMurphy I agree that the end result could be about the same than with a plugin architecture.

That being said, somehow allowing to use to_html::compile directly would be a quick win that would not require any complex architecture.

Would you consider making more of the internals public in the crate?

@wooorm
Copy link
Owner

wooorm commented Jan 22, 2024

to_html does not work on ASTs. The functionality you are looking for is not here.

There will not be a mdast -> html transform.
Eventually there will be an mdast -> hast step, and then finally a hast -> html step.
The first step is already privately implemented in https://github.com/wooorm/mdxjs-rs.
There is no hast -> html step yet, but it would be porting https://github.com/syntax-tree/hast-util-to-html/blob/main/lib/index.js to Rust.

Currently, this project is ± at a level of trying to figure out how people want to use it, before committing to particular APIs.

All of these steps are available in the JavaScript world. As this is Rust, the Rust part might affect it.

@GuillaumeDesforges
Copy link
Author

GuillaumeDesforges commented Jan 22, 2024

Right, I went through the code too quickly. Now I understand why it's a duplicate of #32.

Thanks a lot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants