A simple library to render markdown with Dioxus, at runtime. The best rust crates are involved!
Add dioxus-markdown to your project:
# Cargo.toml
dioxus-markdown = "0.1.0"If you just need to render basic markdown, you can do
use dioxus_markdown::Markdown;
...
rsx!{
Markdown {src:"# Mardown power !"}
}Take a look at the different examples!
After setting up Dioxus, in each example directory, run dx serve --platform=web.
You just need trunk and a web-browser to test them.
The Yew version of these examples can run in the browser from the links in the top level ReadMe.
Custom components allow you to embed interactive Dioxus components in your markdown.
To be recognized as a custom component, tag names must follow these rules:
-
Uppercase start - Tags starting with an uppercase letter (A-Z) are always treated as custom components
- Examples:
<MyComponent>,<Counter>,<DataTable>
- Examples:
-
Lowercase with dash - Tags starting with lowercase (a-z) must contain at least one dash (-)
- Examples:
<my-component>,<data-table>,<custom-counter>
- Examples:
These rules ensure standard HTML tags like <div>, <span>, and <p> are not confused with custom components.
See the custom-components example for a complete working example.
- Update
web-framework-markdownto0.1. - Update Dioxus to
0.7. - Include experimental
substring::ReadWriteBoxto help with custom components which can modify their attributes.