Building with MDX — A Developer's Guide
MDX is a powerful format that lets you write Markdown with embedded React components. Here's how to make the most of it in Project Distri.
What is MDX?
MDX is Markdown for the component era. It lets you:
- Write content in familiar Markdown syntax
- Embed React components directly in your content
- Use frontmatter for metadata
- Import and export JavaScript
Writing Your First Doc
Create a file in content/docs/:
---
title: My First Doc
description: A getting started guide
order: 1
section: Getting Started
---
# My First Doc
This is written in **MDX**!
Using Code Blocks
Code blocks support syntax highlighting:
function greet(name) {
return `Hello, ${name}!`;
}
console.log(greet('World'));
Tables
You can create tables using standard Markdown syntax:
| Feature | Status | |---------|--------| | MDX Support | ✅ | | Dark Mode | ✅ | | Responsive | ✅ | | TypeScript | ✅ |
Blockquotes
MDX combines the readability of Markdown with the power of React components. It's the best of both worlds.
Tips
- Keep frontmatter at the very top of the file
- Use
orderto control sidebar position - Use
sectionto group related docs - Blog posts use
date,author, andexcerptfields