MDX Formatting Guide
This post demonstrates the formatting options available for writing blog posts.
Text Formatting
Standard markdown works as expected: bold text, italic text, and inline code. You can also use links and strikethrough.
Headings
Use ## for main sections, ### for subsections. Avoid using # (h1) in post content since the title is already h1.
Callout Boxes
Pro Tip
Use callouts to highlight important information that readers shouldn't miss.
Info callouts are great for supplementary information.
Watch Out
Warnings help readers avoid common pitfalls.
Notes provide additional context without disrupting the flow.
Quotes with Attribution
The best way to predict the future is to create it.
Stay hungry, stay foolish.
Code Blocks
Code blocks with language specification:
interface User {
id: string;
name: string;
email: string;
}
async function getUser(id: string): Promise<User> {
const response = await fetch(`/api/users/${id}`);
return response.json();
}Another example with JavaScript:
const config = {
theme: 'dark',
language: 'en',
debug: true,
};Dividers
Use dividers to separate major sections:
Side Notes
Lists
Unordered lists:
- First item
- Second item
- Nested item
- Another nested item
- Third item
Ordered lists:
- First step
- Second step
- Third step
Tables
| Feature | Supported | Notes |
|---|---|---|
| Code blocks | Yes | With language hints |
| Images | Yes | With captions |
| Tables | Yes | Standard markdown |
| Callouts | Yes | Four types available |
Link Previews
Next.js by Vercel
The React Framework for the Web. Used by some of the world's largest companies.
nextjs.org
Horizontal Rule
Media Embeds
YouTube Videos
Tweets/X Posts
Summary
This covers the MDX formatting options available for writing blog posts!