Skip to content

Conversation

@danieldaquino
Copy link

Warning

This PR is not ready to merge as-is. It is still a draft/proof-of-concept.

This PR is a proof-of-concept which changes the rendering method for the library. Instead of rendering directly (and dangerously) to HTML, this PR renders Markdown to an abstract syntax tree (AST), and then renders those into Dioxus Nodes.

To accomplish that, the underlying markdown parser was switched to markdown-rs, which is a pure rust markdown parser that supports rendering to an AST (mdast), and also seems to be a stable library.

Demo

For demonstration purposes, here is a screenshot of the example program:

markdown_component_demo

TODO

This is still mostly an experimental proof of concept I built while prototyping something else. I am submitting this PR to gather feedback on the overall approach, and inquire if there is desire/interest in this approach.

Here are things that are still to be done:

  • Allow external views to customize parser options (e.g. to enable or disable certain markdown features such as tables, embedded html, etc).
  • Allow external views to add custom handlers for each markdown AST node (e.g. for better styling control).
  • General code cleanup, documentation, etc.
  • Better error handling
  • Fix inlining of checkboxes
  • Better handling of some node types, or explicitly disallow support (e.g. MDX rendering currently just shows jsx code, perhaps there is a better way to handle this)

Please let me know if there interest in this approach, or any feedback in general. Thank you!

This commit is a proof-of-concept which changes the strategy from
rendering directly to HTML to rendering markdown to an abstract syntax
tree, and then render those to Dioxus nodes.
@dipanshuhappy
Copy link

Curious if this is still being worked on.

@danieldaquino
Copy link
Author

Curious if this is still being worked on.

@dipanshuhappy, I am not currently working on this at the moment. The draft is somewhat functional though, please feel free to use it.

I will likely come back to this at some point, but I don't have any definite plans on it yet.

@dipanshuhappy
Copy link

dipanshuhappy commented Nov 11, 2025

Curious if this is still being worked on.

@dipanshuhappy, I am not currently working on this at the moment. The draft is somewhat functional though, please feel free to use it.

I will likely come back to this at some point, but I don't have any definite plans on it yet.

I see, maybe you can also use this as inspiration
https://github.com/rambip/rust-web-markdown

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.

2 participants