Markdown Extensions

Markdown extensions including frontmatter, custom containers, tables, anchors, and file includes

VitePress extends standard markdown with additional features for documentation.

Frontmatter

YAML metadata at the top of markdown files:

---
title: Page Title
description: Page description for SEO
layout: doc
outline: [2, 3]
---

# Content starts here

Access frontmatter in templates:

# {{ $frontmatter.title }}

Or in script:

<script setup>
import { useData } from 'vitepress'
const { frontmatter } = useData()
</script>

Custom Containers

Styled callout blocks:

Custom titles:

GitHub-flavored Alerts

Alternative syntax using blockquotes:

Header Anchors

Headers get automatic anchor links. Custom anchors:

Table of Contents

Generate a TOC with:

GitHub-Style Tables

Emoji

Use shortcodes:

File Includes

Include content from other files:

With line ranges:

With regions:

Code Snippet Import

Import code from files:

With line highlighting:

With language override:

Import specific region:

Code Groups

Tab groups for code variants:

Import files in code groups:

Math Equations

Requires setup:

Then use LaTeX:

Image Lazy Loading

Raw Container

Prevent VitePress style conflicts:

Key Points

  • Frontmatter supports YAML or JSON format

  • Custom containers support info, tip, warning, danger, details

  • [[toc]] generates table of contents

  • @ in imports refers to source root (or srcDir if configured)

  • Code groups create tabbed code blocks

  • Math support requires markdown-it-mathjax3 package

Last updated

Was this helpful?