Markdown & MDX
Doom supports both standard Markdown and MDX (Markdown + JSX) for writing documentation. This allows you to create rich, interactive documentation with reusable components.Markdown Support
Doom supports the full GitHub Flavored Markdown (GFM) specification, plus additional extensions.Code Callouts
Annotate code with numbered callouts to explain specific lines:Tips for using callouts:
- Use inline code comments appropriate to the language (
;,#,//,/* */,--,<!-- -->) - To treat
[!code callout]as a literal comment, escape it with[\!code callout] - If
:::calloutsdisplays incorrectly due to nesting, use<div class="doom-callouts">or the<Callouts>component instead
Mermaid Diagrams
Create diagrams using Mermaid syntax:Mermaid in VSCode
Mermaid in VSCode
Install the Markdown Preview Mermaid extension for real-time preview in VSCode.
Container Directives
Use custom containers for callouts:MDX Overview
MDX extends Markdown with JSX syntax, enabling interactive components and dynamic content. See the Rspress MDX guide for complete details.Using MDX Files
Create files with the.mdx extension to use JSX components:
example.mdx
Built-in Components
Doom provides global components that work without imports in.mdx files.
Rspress Components
The following Rspress built-in components are available globally:- Badge
- Card/LinkCard
- Tabs
- Steps
Display badges for status, version, or labels:
Doom Components
Doom provides specialized components for documentation:Overview
Display a table of contents for the current section:index.mdx
Directive
An alternative to container syntax, useful for nested content:Container type:
note, tip, info, warning, dangerCustom title for the directive container
ExternalSite
Reference external documentation sites:sites.yaml.
ExternalSiteLink
Create links to external sites:Term
Insert dynamic terminology:Built-in term name from your terminology configuration
Text transformation to apply
TermsTable
Display a table of all defined terms:JsonViewer
Render JSON data with syntax highlighting:PackageManagerTabs
Quickly show commands for different package managers:Custom Components
Create reusable components in theshared directory:
shared/CommonContent.tsx
content.mdx
Internationalization in Components
Use theuseI18n hook for multilingual components:
Define translations
docs/i18n.json
Use in React components
shared/Welcome.tsx
Use in MDX files
welcome.mdx
Best Practices
When to use Markdown vs MDX
When to use Markdown vs MDX
- Use Markdown (
.md) for simple, static content - Use MDX (
.mdx) when you need:- Interactive components
- Dynamic content
- Component reuse
- Access to runtime APIs
Component organization
Component organization
- Store reusable components in
docs/shared/ - Use
.tsxfor components that need props - Use
.mdxfor simple content snippets - Keep API-related components separate from content components
Performance tips
Performance tips
- Avoid heavy client-side logic in MDX components
- Use static content when possible
- Lazy load large components
- Minimize the number of imported dependencies