The editor now supports MDX (Markdown with JSX) to enhance your documents with dynamic components and interactive elements.
MDX allows you to use JSX (JavaScript XML) directly in your markdown files. This enables:
- Using React components in your markdown
- Creating interactive documents with dynamic content
- Embedding custom visualizations, charts, and UI elements
- Implementing sophisticated document layouts
MDX files support all standard Markdown syntax, plus JSX components:
# My MDX Document
Regular markdown **bold** and *italic* works normally.
## Using Components
<CustomComponent prop="value">
This is content inside the component
</CustomComponent>
## Mixing Markdown and JSX
You can mix markdown and JSX freely:
- List item 1
- <Highlight>List item with a component</Highlight>
- List item 3You can use JavaScript expressions in curly braces:
# Dynamic Content
The current date is: {new Date().toLocaleDateString()}
{['apple', 'banana', 'orange'].map(fruit => (
<li key={fruit}>{fruit}</li>
))}You can import components at the top of your MDX file:
import { Chart } from './components/Chart'
import { Counter } from './components/Counter'
# My Interactive Dashboard
Here's a chart of our data:
<Chart data={myData} />
And a counter component:
<Counter initialValue={5} />- Full Monaco Editor integration with JSX syntax highlighting
- Code completion for common JSX elements
- Live preview of MDX content
- Support for frontmatter metadata
- Export to HTML or PDF with rendered components
The MDX support is implemented using:
- Monaco Editor with custom language configuration
- next-mdx-remote for server-side and client-side rendering
- Custom components for specialized UI elements
- Component library for common document elements
- Theme customization for MDX components
- Better debugging tools for MDX errors
- Template system with pre-built MDX layouts