Setting the file. One moment.
Subchapter 12.5
references/core-markdown.mdMarkdown4 KBView on GitHub
VitePress extends standard markdown with additional features for documentation.
YAML metadata at the top of markdown files:
---
title: Page Title
description: Page description for SEO
layout: doc
outline: [2, 3]
---
# Content starts hereAccess frontmatter in templates:
# {{ $frontmatter.title }}Or in script:
<script setup>
import { useData } from 'vitepress'
const { frontmatter } = useData()
</script>Styled callout blocks:
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details Click to expand
Hidden content here.
:::Custom titles:
::: danger STOP
Do not proceed!
:::
::: details Click me {open}
Open by default with {open} attribute.
:::Alternative syntax using blockquotes:
> [!NOTE]
> Highlights information users should know.
> [!TIP]
> Optional information for success.
> [!WARNING]
> Critical content requiring attention.
> [!CAUTION]
> Negative potential consequences.Headers get automatic anchor links. Custom anchors:
# My Heading {#custom-anchor}
[Link to heading](#custom-anchor)Generate a TOC with:
[[toc]]| Feature | Status |
|---------|--------|
| SSR | ✅ |
| HMR | ✅ |Use shortcodes:
:tada: :rocket: :100:Include content from other files:
<!--@include: ./shared/header.md-->With line ranges:
<!--@include: ./code.md{3,10}--> <!-- Lines 3-10 -->
<!--@include: ./code.md{3,}--> <!-- From line 3 -->
<!--@include: ./code.md{,10}--> <!-- Up to line 10 -->With regions:
<!-- In parts/basics.md -->
<!-- #region usage -->
Usage content here
<!-- #endregion usage -->
<!-- Include just that region -->
<!--@include: ./parts/basics.md#usage-->Import code from files:
<<< @/snippets/example.jsWith line highlighting:
<<< @/snippets/example.js{2,4-6}With language override:
<<< @/snippets/example.cs{1,2 c#:line-numbers}Import specific region:
<<< @/snippets/example.js#regionName{1,2}Tab groups for code variants:
::: code-group
```js [config.js]
export default { /* ... */ }
```
```ts [config.ts]
export default defineConfig({ /* ... */ })
```
:::Import files in code groups:
::: code-group
<<< @/snippets/config.js
<<< @/snippets/config.ts
:::Requires setup:
npm add -D markdown-it-mathjax3@^4// .vitepress/config.ts
export default {
markdown: {
math: true
}
}Then use LaTeX:
Inline: $E = mc^2$
Block:
$$
\frac{-b \pm \sqrt{b^2-4ac}}{2a}
$$export default {
markdown: {
image: {
lazyLoading: true
}
}
}Prevent VitePress style conflicts:
::: raw
<CustomComponent />
:::[[toc]] generates table of contents@ in imports refers to source root (or srcDir if configured)