本站 Markdown 写作速查

635 words
3 minutes
本站 Markdown 写作速查

写文章时最常用的语法集中在这里,方便随时回来抄。

基础语法#

**加粗** *斜体* ~~删除线~~ `行内代码`
# 一级标题(正文里一般从 ## 开始用)
> 引用
- 无序列表
- 第二项
1. 有序列表
2. 第二项
[链接文字](https://example.com)
![图片说明](./step-1.png)
| 表头 | 表头 |
| --- | --- |
| 内容 | 内容 |

提示框#

主题内置了四种提示框,写法是 :::类型 加内容:

:::note
补充说明。
:::
:::tip
小技巧。
:::
:::important
重要信息。
:::
:::caution
注意,可能会出问题。
:::

渲染出来是这样:

Note

这是一条补充说明。

Tip

这是一条小技巧。

Caution

这是一条警告,提醒你注意某个坑。

代码块#

用三个反引号加语言名,会带上语法高亮、行号和复制按钮:

```ts
const greeting = "hello";
console.log(greeting);
```
const greeting = "hello";
console.log(greeting);

数学公式#

行内公式用单个 $,独立公式用两个 $$:

质能方程 $E = mc^2$ 大家都见过。
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$

效果:质能方程 E=mc2E = mc^2 大家都见过。

∫−∞∞e−x2dx=π\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}

图表#

Mermaid#

```mermaid
graph LR
A[写 Markdown] --> B[构建]
B --> C[上传 dist]
C --> D[线上生效]
```

写 Markdown

构建

上传 dist

线上生效

写 Markdown

构建

上传 dist

线上生效

PlantUML#

```plantuml
@startuml
Alice -> Bob: 请求
Bob --> Alice: 响应
@enduml
```

GitHub 卡片#

直接插入仓库卡片:

::github{repo="CuteLeaf/Firefly"}
CuteLeaf
/
Firefly
🍀Firefly, fresh and aesthetic Astro blog theme template.
—
—
MIT
Astro

文章加密#

在 front-matter 里设置密码,整篇文章会被加密:

---
title: 私密文章
password: "123456"
passwordHint: "六位数字"
---

正文在浏览器端解密,密码不会出现在构建产物里。但这是前端加密,只适合挡住随手点进来的人,不要用来存真正敏感的东西。

支持的提示框类型#

:::类型 里的类型名可以是下面任意一个,写哪个都会渲染成对应颜色的提示框:

note tip important warning caution
info todo success question danger
example quote abstract failure bug

文章 front-matter 速查#

---
title: 文章标题 # 必填
published: 2026-09-20 # 必填,发布时间
description: 文章简介 # 显示在列表和分享卡片
image: ./cover.avif # 封面图,可用相对路径
tags: [标签1, 标签2] # 标签
category: 分类名 # 分类,只能有一个
draft: false # true 表示只在本地显示
pinned: false # true 会置顶
comment: true # 是否允许评论
series: 系列名 # 系列文章
seriesOrder: 1 # 系列中的顺序
---
Tip

category 只能是一个分类,tags 可以有很多个。分类用于归档页的大类划分,标签用于交叉检索——分类别乱建,标签可以随便加。

Share Article

If this article helped you, please share it with others!

本站 Markdown 写作速查
https://boyuan.net.cn/en/posts/markdown-cheatsheet/
Author
Boyuan
Published at
2026-09-20

Comments

Profile Image of the Author
Boyuan
石以砥焉,化钝为利。
欢迎来访
石以砥焉,化钝为利。这里是我的个人站点,主要记录学习笔记、项目实践和一些零散的想法。站内文章可用右上角搜索,也可以订阅 RSS。
Categories
Tags
Latest Moments
Site Statistics
Posts
139
Categories
17
Tags
49
Total Words
1,721,112
Running Days
0 days
Last Activity
0 days ago
Site Info
Build Platform
Local
Blog Version
v1.0.0
License
CC BY-NC-SA 4.0
Table of Contents