Complete Guide to Markdown & MDX Features
Welcome to the complete documentation for all markdown and MDX features available in this blog.
Table of Contents
- Frontmatter
- Alerts
- Collapsible Sections
- Code Blocks
- Tabbed Code Examples
- Images and Figures
- Enhanced Images
- Video Embeds
- Math Equations
- Quiz System
- Smart Typography
- Emoji Support
- Anchor Links
- Tables
- Blockquotes
Frontmatter
Every blog post starts with YAML frontmatter:
📖 Frontmatter Template
---
author: Your Name
category: Category Name
date: 2024-01-11T00:00:00Z
description: A brief description of your post for SEO
priority: 10
difficulty: Beginner | Intermediate | Advanced
draft: false
# Optional: Set custom reading time
# readingTime: "5 min"
image:
alt: "Image description"
src: "/images/path/to/image.webp"
layout: ../../../layouts/BlogPostLayout.astro
prerequisites:
- Prerequisite 1
- Prerequisite 2
quiz:
description: "Test your knowledge"
questions:
- o:
- "Option A"
- "Correct Answer*"
- "Option C"
- "Option D"
q: "Your question here?"
tags:
- Tag1
- Tag2
title: 'Your Post Title'
---
Frontmatter Fields
| Field | Required | Description |
|---|---|---|
author | Yes | Author name |
category | Yes | Category (e.g., AI & Machine Learning) |
date | Yes | Publication date (ISO format) |
description | Yes | Brief description for SEO |
priority | Yes | Sort order (lower = shown first) |
difficulty | No | Beginner/Intermediate/Advanced |
draft | No | Set true to hide from published posts |
readingTime | No | Custom reading time (e.g., “5 min”) |
image | No | Hero image configuration |
prerequisites | No | List of prerequisites |
quiz | No | Interactive quiz configuration |
tags | No | Array of tags |
Alerts
Callout boxes for highlighting important information.
Types: note, tip, warning, important, caution, info
This is a note alert for general information.
Pro Tip
Tips share best practices with readers.
⚠️ Warning
Warnings alert about potential issues.
❗ Important
Critical information readers must not miss.
🚧 Caution
Warns about potential risks.
ℹ️ Information
Provides additional context or details.
Alert Usage
<Alert type="note" title="Optional Title">
Your content here...
</Alert>
<Alert type="tip">
<h4>Custom Title</h4>
<p>You can customize the title.</p>
</Alert>
Collapsible Sections
Hide/show content on demand.
📖 Click to reveal hidden content
This content is hidden by default. Use for:
- Prerequisites
- Extended code examples
- Detailed explanations
- Step-by-step instructions
📖 Expanded by Default
This section is open by default.
Collapsible Usage
<Collapsible title="Section Title">
Hidden content goes here...
</Collapsible>
<Collapsible title="Expanded" defaultCollapsed={false}>
Open by default...
</Collapsible>
Code Blocks
Standard markdown code blocks with syntax highlighting and copy buttons:
def example_function():
data = {"key": "value"}
return data
const greeting = "Hello, World!";
console.log(greeting);
npm install package-name
npm run dev
fn main() {
println!("Hello, World!");
}
Inline Code
Use backticks for inline code: const variable = value;
Supported Languages
The blog supports syntax highlighting for many languages including:
- JavaScript, TypeScript, Python, Rust, Go
- HTML, CSS, SCSS, JSON, YAML
- Bash, Shell, PowerShell
- SQL, GraphQL
- And many more…
Tabbed Code Examples
Compare code in multiple languages:
# API Request Example
import httpx
async def fetch_data(url: str) -> dict:
async with httpx.AsyncClient() as client:
response = await client.get(url)
return response.json()
# Usage
import asyncio
data = asyncio.run(fetch_data("https://api.example.com/data"))
// API Request Example
async function fetchData(url) {
const response = await fetch(url);
return response.json();
}
// Usage
fetchData('https://api.example.com/data')
.then(data => console.log(data));
# cURL Example
curl -X GET https://api.example.com/data \
-H "Accept: application/json"
Placeholder Tabs
# First tab - click to reveal
def hello():
return "Hello, World!"
// Click another tab to switch
function hello() {
return "Hello, World!";
}
Images and Figures
Display images with captions and aspect ratios.
<Figure
src="/path/to/image.jpg"
alt="Image description"
caption="Image caption"
width="500px"
height="300px"
ratio="16:9"
fit="cover"
align="center"
/>
Parameter Reference
| Parameter | Type | Default | Description |
|---|---|---|---|
src | string | Required | Image URL or path |
alt | string | Required | Alt text for accessibility |
caption | string | ”Image” | Caption text |
width | string | - | Fixed width (e.g., “500px”) |
height | string | - | Fixed height (e.g., “300px”) |
ratio | string | ”auto” | Aspect ratio |
fit | string | ”cover” | Object-fit: cover, contain, fill |
align | string | ”center” | Alignment: left, center, right |
collapsible | boolean | false | Make expandable |
Aspect Ratio Examples
📸 Supported Ratios
16:9 (landscape), 4:3 (standard), 3:2 (photo), 1:1 (square), 9:16 (portrait), auto
16:9 (Landscape)
4:3 (Standard)
1:1 (Square)
(Auto)
Enhanced Images
Enhanced images with lightbox, zoom, and lazy loading features.
EnhancedImage Features
- Lightbox: Click to open full-size image
- Zoom: Hover to see zoom effect
- Lazy Loading: Images load as you scroll
- Error Fallback: Shows placeholder if image fails to load
- Auto Caption: Generates caption from filename if not provided
Usage
<EnhancedImage
src="/path/to/image.jpg"
alt="Image description"
caption="Optional caption"
width={800}
height={600}
loading="lazy"
priority={false}
/>
Parameter Reference
| Parameter | Type | Default | Description |
|---|---|---|---|
src | string | Required | Image URL or path |
alt | string | Required | Alt text |
caption | string | Auto | Caption text |
width | number | 800 | Image width |
height | number | 600 | Image height |
loading | string | ”lazy" | "lazy” or “eager” |
priority | boolean | false | Preload image |
fullSrc | string | src | Full-size image for lightbox |
Video Embeds
Embed YouTube and Vimeo videos.
Usage
<VideoEmbed
src="https://youtube.com/watch?v=..."
title="Video Title"
width="800px"
ratio="16:9"
autoplay={false}
loop={false}
muted={false}
controls={true}
/>
Parameter Reference
| Parameter | Type | Default | Description |
|---|---|---|---|
src | string | Required | YouTube or Vimeo URL |
title | string | ”Video” | Video title |
width | string | - | Maximum width |
ratio | string | ”16:9” | Aspect ratio |
autoplay | boolean | false | Auto-play on load |
loop | boolean | false | Loop playback |
muted | boolean | false | Start muted |
controls | boolean | true | Show controls |
Video Ratio Examples
16:9 (Standard)
21:9 (Ultrawide)
Math Equations
Write LaTeX math equations with KaTeX support.
Inline Math
Use $...$ for inline math:
Block Math
Use $$...$$ for block equations:
Math Examples
Algebra
Calculus
Matrices
Greek Letters
Usage
Inline: $E = mc^2$
Block:
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
KaTeX provides fast math rendering. For a complete symbol reference, visit the KaTeX documentation.
Quiz System
Add interactive quizzes to test reader knowledge. Configure in frontmatter:
Quiz Structure
quiz:
description: "Test your knowledge"
questions:
- o:
- "Option A"
- "Correct Answer*" # Asterisk marks correct answer
- "Option C"
- "Option D"
q: "Question text here?"
- o:
- "A"
- "B*"
- "C"
- "D"
q: "Another question?"
title: "Quiz Title"
Quiz Question Format
- o:
- "First option"
- "Correct answer*"
- "Third option"
- "Fourth option"
q: "Your question goes here?"
✅ Quiz Features
- Multiple choice questions
- Auto-grading with correct answers
- Results displayed to readers
- Supports any number of questions
📖 Quiz Example Frontmatter
quiz:
description: "Test your understanding of the topic"
questions:
- o:
- "Basic programming"
- "Advanced AI systems*"
- "Database management"
- "Network security"
q: "What is the primary focus of this guide?"
- o:
- "Use alerts sparingly"
- "Use them for all content"
- "Highlight important information*"
- "Replace all headings"
q: "When should you use alerts?"
title: "Section Quiz"
Smart Typography
Automatic transformations applied to text:
| Input | Output | Description |
|---|---|---|
... | … | Ellipsis |
-- | – | En dash |
--- | — | Em dash |
'' | ”curly quotes” | Smart quotes |
Examples
- Three dots… become an ellipsis…
- Double dashes—create proper en dashes---
- Triple dashes---render as em dashes
- Smart quotes” for proper typography
✒️ Smart Typography
Transformations happen automatically in paragraph text, list items, and content areas.
Emoji Support
Use standard emoji directly in your content.
Faces & Emotions
😊 😃 😄 😆 😂 😉 😍 👍 👎
Objects & Symbols
🚀 🔥 ⭐ 📚 💻 ⚙️ 🔧 🔔 🔗
Indicators
✅ ❌ ⚠️ ❓ 💡 🏆 🎉
Usage
Welcome to the guide 🚀 Check your configuration ⚠️
Use the check mark ✅ when done, or the X ❌ to cancel.
You can use any emoji directly in your MDX content. They render consistently across all devices.
Anchor Links
Heading links are automatically generated.
Usage
Simply use standard markdown headings:
## Section Title
### Subsection
#### Deep Dive
Hover over any heading to see a link icon. Click to copy the anchor link.
🔗 Auto-Generated
Anchor links work for all headings (h1-h6) automatically.
Tables
Create data tables with markdown:
| Feature | Ghost CMS | WordPress | Astro |
|---|---|---|---|
| Performance | Fast | Variable | Blazing |
| Ease of Use | Easy | Medium | Hard |
| Plugins | Limited | 60,000+ | N/A |
| Static Export | Yes | Yes | Native |
Usage
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
Blockquotes
Highlight quoted content:
“The best way to predict the future is to create it.” — Peter Drucker
Usage
> Your quote here
> — Author Name
Quick Reference
✅ Component Summary
- Alerts:
<Alert type=“info”>…</Alert> - Collapsible:
<Collapsible title=”…”>…</Collapsible> - Code:
python code - Tabs:
<TabbedCode tabs=AB>…</TabbedCode> - Figures:
<Figure src=”…” ratio=“16:9” /> - Enhanced Images:
<EnhancedImage src=”…” /> - Videos:
<VideoEmbed src=”…” ratio=“16:9” /> - Math:
or - Quiz: Configure in frontmatter
📚 Next Steps
- Review existing blog posts for examples
- Plan your blog post structure
- Write content with appropriate features
- Test locally before publishing
All Supported Features Checklist
📋 Feature Checklist
📖 Core Features
- YAML Frontmatter
- Markdown headings (h1-h6)
- Paragraphs and text formatting
- Lists (ordered and unordered)
- Links and images
- Code blocks with syntax highlighting
- Tables
- Blockquotes
📖 Custom Components
- Alert callouts (6 types)
- Collapsible sections
- Tabbed code examples
- Figure images with ratios
- Enhanced images with lightbox
- Video embeds
- Interactive quizzes
- Copy-to-clipboard buttons
- Math equations (KaTeX)
📖 Text Enhancements
- Smart typography (… → …)
- Emoji support
- Auto-generated anchor links
- Syntax highlighting (Shiki)
- Inline code styling
Happy writing! ✍️
Discussion
0 commentsJoin the Discussion
Sign in to post comments and join the conversation.
No comments yet. Be the first to share your thoughts!