Complete Guide to Markdown & MDX Features

Complete guide to using all markdown and MDX features available in this blog. Learn how to use alerts, collapsible sections, code blocks, video embeds, quizzes, math equations, and more.

Rafi
Written by Rafi
📅
Published January 11, 2024
⏱️
Read Time 2 min
📊
Difficulty Beginner

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

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

FieldRequiredDescription
authorYesAuthor name
categoryYesCategory (e.g., AI & Machine Learning)
dateYesPublication date (ISO format)
descriptionYesBrief description for SEO
priorityYesSort order (lower = shown first)
difficultyNoBeginner/Intermediate/Advanced
draftNoSet true to hide from published posts
readingTimeNoCustom reading time (e.g., “5 min”)
imageNoHero image configuration
prerequisitesNoList of prerequisites
quizNoInteractive quiz configuration
tagsNoArray of tags

Alerts

Callout boxes for highlighting important information.

Types: note, tip, warning, important, caution, info

📝 Note

This is a note alert for general information.

💡 Tip

Pro Tip

Tips share best practices with readers.

⚠️ Warning

⚠️ Warning

Warnings alert about potential issues.

Important

❗ Important

Critical information readers must not miss.

🚧 Caution

🚧 Caution

Warns about potential risks.

ℹ️ Info

ℹ️ 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:

Press on a tab to see code
# 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

Press on a tab to see code
# 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

ParameterTypeDefaultDescription
srcstringRequiredImage URL or path
altstringRequiredAlt text for accessibility
captionstring”Image”Caption text
widthstring-Fixed width (e.g., “500px”)
heightstring-Fixed height (e.g., “300px”)
ratiostring”auto”Aspect ratio
fitstring”cover”Object-fit: cover, contain, fill
alignstring”center”Alignment: left, center, right
collapsiblebooleanfalseMake 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)

AI Technology Landscape
16:9 - Standard landscape format

4:3 (Standard)

Code on screen
4:3 - Standard photo format

1:1 (Square)

Technology square
1:1 - Square format for social media

(Auto)

AI Technology Landscape
auto - Standard landscape format

Enhanced Images

Enhanced images with lightbox, zoom, and lazy loading features.

Code on computer
Hover to zoom - Click to open lightbox

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

ParameterTypeDefaultDescription
srcstringRequiredImage URL or path
altstringRequiredAlt text
captionstringAutoCaption text
widthnumber800Image width
heightnumber600Image height
loadingstring”lazy""lazy” or “eager”
prioritybooleanfalsePreload image
fullSrcstringsrcFull-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

ParameterTypeDefaultDescription
srcstringRequiredYouTube or Vimeo URL
titlestring”Video”Video title
widthstring-Maximum width
ratiostring”16:9”Aspect ratio
autoplaybooleanfalseAuto-play on load
loopbooleanfalseLoop playback
mutedbooleanfalseStart muted
controlsbooleantrueShow 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: E=mc2E = mc^2

Block Math

Use $$...$$ for block equations:

ex2dx=π\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}

Math Examples

Algebra

x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Calculus

ddxex=ex\frac{d}{dx} e^x = e^x

Matrices

(abcd)\begin{pmatrix} a & b \\ c & d \end{pmatrix}

Greek Letters

α,β,γ,δ,ϵ,π,σ,ω\alpha, \beta, \gamma, \delta, \epsilon, \pi, \sigma, \omega

Usage

Inline: $E = mc^2$

Block:
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
💡 Tip

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:

InputOutputDescription
...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.
💡 Tip

You can use any emoji directly in your MDX content. They render consistently across all devices.


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:

FeatureGhost CMSWordPressAstro
PerformanceFastVariableBlazing
Ease of UseEasyMediumHard
PluginsLimited60,000+N/A
Static ExportYesYesNative

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: E=mc2E=mc^2 or ......
  • Quiz: Configure in frontmatter

📚 Next Steps

  1. Review existing blog posts for examples
  2. Plan your blog post structure
  3. Write content with appropriate features
  4. 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! ✍️

Markdown Features Quiz

Test your knowledge of markdown features

Discussion

0 comments
Reading Progress
4 min left 0%
Welcome back! Sign in to join the discussion.

Please verify your email to sign in.

Enter the 6-digit code from your verification email.

Didn't receive the email?

Remember your password?

Create an account to comment and join the community.
Letters, numbers, and underscores only

Check your email! We've sent a verification code.

Enter the 6-digit code to complete your registration, or click the link in your email.

Didn't receive the email?

Wrong email?

Enter your email address and we'll send you a code to reset your password.

Remember your password?

Enter the 6-digit code from your email and create a new password.

Didn't receive code?

Welcome aboard!

Your account has been created successfully.

Welcome back! Sign in to join the discussion.

Please verify your email to sign in.

Enter the 6-digit code from your verification email.

Didn't receive the email?

Remember your password?

Create an account to comment and join the community.
Letters, numbers, and underscores only

Check your email! We've sent a verification code.

Enter the 6-digit code to complete your registration, or click the link in your email.

Didn't receive the email?

Wrong email?

Enter your email address and we'll send you a code to reset your password.

Remember your password?

Enter the 6-digit code from your email and create a new password.

Didn't receive code?

Welcome aboard!

Your account has been created successfully.