Markdown & MDX
Rspress supports not only Markdown but also MDX, a powerful way to develop content. You can link to a section, such as Use Component.
Markdown
MDX is a superset of Markdown, which means you can write Markdown files as usual. For example:
Use Component
When you want to use React components in Markdown files, you should name your files with .mdx extension. For example:
Front Matter
You can add Front Matter at the beginning of your Markdown file, which is a YAML-formatted object that defines some metadata. For example:
Note: By default, Rspress uses h1 headings as html headings.
You can also access properties defined in Front Matter in the body, for example:
The previously defined properties will be passed to the component as frontmatter properties. So the final output will be:
Custom Container
You can use the ::: syntax to create custom containers and support custom titles. For example:
Input:
Output:
This is a block of type note
This is a block of type tip
This is a block of type info
This is a block of type warning
This is a block of type danger
Details
This is a block of type details
This is a block of Custom Title
This is a block of Custom Title
Code Block
Basic Usage
You can use the ``` syntax to create code blocks and support custom titles. For example:
Input:
Output:
Show Line Numbers
If you want to display line numbers, you can enable the showLineNumbers option in the config file:
Wrap Code
If you want to wrap long code line by default, you can enable the defaultWrapCode option in the config file:
Line Highlighting
You can also apply line highlighting and code block title at the same time, for example:
Input:
Ouput:
Rustify MDX compiler
You can enable Rustify MDX compiler by following config:


