MDX: A Complete Example
MDX lets you combine Markdown, React components, and JS expressions in a single file.
Here’s an inline expression:
The result of 2 + 3 is 5.
Headings
This is a third-level heading
Normal paragraph text with italics, bold, and inline code.
Lists
Unordered list:
- First item
- Second item
- Sub item
- Third item
Ordered list:
- Step one
- Step two
- Step three
Task list:
- Works?
- Maybe?
- Definitely not.
Custom Diagrams Example
Graph Diagram
Loading diagram...
Sequential Diagram
Loading diagram...
Flowchart Diagram
Loading diagram...
Images
Example Image
Links
Using JSX Components
Below is a custom JSX component imported at the top:
You can also pass expressions:
Tables
| Feature | Supported | Notes |
|---|---|---|
| Markdown | ✅ | Works as usual |
| JSX | ✅ | Any React component |
| Expressions | ✅ | Inline or blocks |
Code Blocks
js
export function add(a, b) {
return a + b;
}
console.log(add(2, 5));
jsx
function Greeting({ name }) {
return <h1>Hello, {name}!</h1>;
}
Blockquote
MDX is powerful because it blends Markdown and React components.
MDX Expression Block
This is generated line 1
This is generated line 2
This is generated line 3
Footer
Thanks for reading! MDX is awesome 🚀