Skip to content

Writing Guide

This site's documentation is written in Markdown and supports extended syntax such as Frontmatter, tip containers, code highlighting and math formulas.

Frontmatter

Declare page metadata with YAML at the top of the file:

md
---
title: 页面标题
description: 页面描述(用于 SEO)
tags:
  - 指南
  - Markdown
---

# 正文标题

Common fields:

FieldDescription
titlePage title, overrides the navigation bar display
descriptionPage description, used for search engines and share cards
tagsPage tags
layoutPage layout, default doc, the home page uses home
outlineWhether to show the right-side table of contents

Tip Containers

md
:::: tip 提示
这是一条提示信息。
::::

:::: warning 注意
这是一条警告信息。
::::

:::: danger 危险
这是一条危险信息。
::::

:::: info 说明
这是一条普通说明。
::::

Preview:

提示

这是一条提示信息。

注意

这是一条警告信息。

危险

这是一条危险信息。

说明

这是一条普通说明。

Code Blocks

Syntax highlighting is supported for common languages such as js, ts, bash, python, json and sql, and line numbers with highlighted lines are supported:

md
```js {2,4-5}
function greet(name) {
  const message = `Hello, ${name}!` // 高亮行
  console.log(message)
  return message
}
```
js
function greet(name) {
  const message = `Hello, ${name}!` // 高亮行
  console.log(message)
  return message
}

Math Formulas

KaTeX renders math formulas:

md
行内公式 $E = mc^2$

块级公式:

$$
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$

Tables

md
| 方法 | 路径 | 说明 |
| --- | --- | --- |
| GET | `/api/users` | 获取用户列表 |
| POST | `/api/users` | 创建用户 |
| DELETE | `/api/users/:id` | 删除用户 |
md
![替代文本](/logo.svg)

[跳转到快速开始](./getting-started)

Component Extension

VitePress supports using Vue components directly in Markdown, so complex interactions (charts, demos, tabs, etc.) can be encapsulated into reusable components.


Writing Advice

  • Each document focuses on one topic, using clear heading levels (######);
  • Code examples must be runnable and include necessary comments;
  • Use tip containers to emphasize caveats and edge cases;
  • Use relative links between related documents for cross-navigation.

Built with VitePress · Knowledge shared openly