Markdown 语法速查,每条规则旁边带实时预览,含 GFM 和各种方言。
- 本地处理
- 分类 开发运维
- 适合 格式化、校验、压缩或检查和代码相关的文本。
基础 (17)
一级标题
# Heading 1
一级标题。ATX 风格,前面一个 `#`。
Heading 1
二级标题
## Heading 2
段落标题。
Heading 2
三级标题
### Heading 3
子段落标题。最多 6 级(`######`)。
Heading 3
Setext 标题
Big title ========= Smaller title -------------
另一种标题写法:`===` 下划线表 H1,`---` 表 H2。
注意: Only H1 and H2 supported in Setext form.
Big title
Smaller title
段落
A paragraph is just text with a soft wrap. Blank line starts new paragraph.
空行分隔的纯文本就是段落。
A paragraph is just text with a soft wrap.
Blank line starts new paragraph.
加粗
**bold text** or __bold text__
用两个 `*` 或两个 `_` 包起来。
bold text or bold text
斜体
*italic* or _italic_
单个 `*` 或 `_`。词中间最好别用 `_`,容易踩坑。
italic or italic
加粗 + 斜体
***bold italic*** or **_mixed_**
三个 `*`,或 `**` 与 `_` 组合。
bold italic or mixed
分割线
--- or *** or ___
单独一行三个以上 `-`、`*` 或 `_`。
or
or
换行
line one line two
行尾加两个空格强制段内换行。
注意: Or use a `\` backslash at end of line.
line one line two
转义
\*literal asterisks\* and \_underscores\_
在特殊字符前加反斜杠,按字面渲染。
\literal asterisks\ and \underscores\
指定 id 的标题
## Setup {#install}部分渲染器(GitLab、kramdown、Pandoc)支持 `{#id}` 覆盖自动生成的 slug。
注意: Not GFM. GitHub ignores the braces and renders them as text.
Setup {#install}
软换行与硬换行
line one line two becomes one line blank line splits paragraphs
单个换行是软换行,会合成同一行。空行才分段。
line one line two becomes one line
blank line splits paragraphs
词内加粗
un**believ**able
`**` 在词中间有效,`__` 无效。CommonMark 里词内的 `_` 按字面处理。
unbelievable
转义反引号
A literal backtick: \`
代码区外,反斜杠可转义反引号。
A literal backtick: \`
带空格的分割线
- - - or * * *
分割线的三个字符之间可以带空格。
or
反斜杠换行
line one\ line two
行尾反斜杠强制硬换行,比两个空格更显眼。
注意: CommonMark and GFM support it; some older parsers do not.
line one\ line two
列表 (10)
无序列表
- apple - banana - cherry
`-`、`*` 或 `+` 后接空格。
- apple
- banana
- cherry
有序列表
1. first 2. second 3. third
数字加 `.`。其实全写 `1.` 也行,渲染器会自动编号。
- first
- second
- third
嵌套列表
- top
- nested
- deeper
- back to top嵌套缩进 2 空格(CommonMark)或 4 空格(部分方言)。
- top
- nested
- deeper
- back to top
有/无序混合嵌套
1. ordered - bullet - bullet 2. ordered
不同缩进可混合 `1.` 与 `-`。
- ordered
- bullet
- bullet
- ordered
有序列表自定义起点
5. five 6. six 7. seven
第一个数字决定起点,后续自动从它顺延。
- five
- six
- seven
括号有序列表
1) first 2) second
CommonMark 也接受 `)` 作为有序列表分隔符,不只是 `.`。
1) first 2) second
松散列表
- item one - item two - item three
条目间留空行变松散列表,每条会被包进 `<p>`。
- item one
- item two
- item three
多段落列表项
1. First paragraph. Second paragraph, indented 3 spaces. 2. Next item.
后续段落缩进对齐到条目正文,才算同一条。
- First paragraph.
Second paragraph, indented 3 spaces.
- Next item.
列表内代码块
- step: ```sh npm run build ```
围栏代码块缩进到条目下(空行加对齐)即可嵌套。
- step:
npm run build定义列表
Term : Definition of the term : Second definition
Pandoc/kramdown/PHP Markdown Extra:术语加 `:` 行。CommonMark/GFM 不支持。
注意: GitHub renders this as plain text.
Term : Definition of the term : Second definition
链接与图片 (12)
行内链接
[Toolora](https://toolora.com)
最常用的形式。文本放 `[]`,URL 放 `()`。
带标题链接
[Toolora](https://toolora.com "Tooltip")
URL 后的引号字符串作为悬浮提示。
引用式链接
Visit [Toolora][site] today. [site]: https://toolora.com "Tooltip"
URL 在别处定义。同一 URL 反复出现或太长时好用。
Visit [Toolora][site] today.
[site]: https://toolora.com "Tooltip"
自动链接
<https://toolora.com> or <hi@toolora.com>
裸 URL 或邮箱用 `<>` 包起来,自动变可点击。
https://toolora.com or <hi@toolora.com>
图片

类似链接,前面加 `!`。`alt` 在图加载失败时显示。

带标题图片

引号里的标题作为悬浮提示。

引用式图片
![logo][img] [img]: https://toolora.com/logo.png
图片的引用式写法,与引用式链接结构相同。
![logo][img]
[img]: https://toolora.com/logo.png
隐式引用链接
Read the [docs][]. [docs]: https://toolora.com/docs
空 `[]` 直接用链接文本作为引用标签。
Read the [docs][].
[docs]: https://toolora.com/docs
相对路径链接
See [the readme](./README.md) and [a section](../docs/setup.md#install).
相对路径在多数平台按当前文件位置解析。
See the readme and a section.
邮箱链接
[Email us](mailto:hi@toolora.com)
在普通行内链接里用 `mailto:` URL,点击后打开邮件客户端。
徽章图片

徽章本质就是指向 shields.io 这类服务的图片。
代码 (11)
行内代码
Run `npm install` then go.
反引号包起来。
Run npm install then go.
含反引号的行内代码
Use `` `code` `` if your code contains a backtick.
双反引号包裹,内部可含单个反引号。
Use ` code ` if your code contains a backtick.
围栏代码块
``` const x = 1; console.log(x); ```
单独一行三个反引号,前后包裹多行代码。
const x = 1;
console.log(x);带语言的代码块
```js const x = 1; console.log(x); ```
在开头围栏后写语言名,启用语法高亮。
const x = 1;
console.log(x);波浪号围栏代码
~~~python
print("hi")
~~~`~~~` 是另一种围栏写法。代码里要写三个反引号时好用。
print("hi")缩进代码块
Normal paragraph.
indented 4 spaces
is a code block缩进 4 空格(或 1 个 Tab)。老语法,推荐用围栏。
Normal paragraph.
indented 4 spaces is a code block
四反引号围栏
```` ``` nested fence shown literally ``` ````
更长的围栏可以包住内部本身含三反引号的代码。
nested fence shown literally
行内代码首尾空格
`` `a` ``
首尾各一个空格会被去掉,从而让代码以反引号开头或结尾。
` a `
diff 高亮
```diff - old line + new line ```
`diff` 语言在 GitHub 上把 `+`/`-` 行染成绿色和红色。
- old line
+ new lineMermaid 流程图
```mermaid graph TD A --> B B --> C ```
GitHub 与 GitLab 把 ` ```mermaid ` 块渲染成图表。
注意: Plain CommonMark shows it as a code block.
graph TD
A --> B
B --> CJSON 代码块
```json
{
"name": "toolora",
"private": true
}
```围栏标 `json`,键值对会高亮。
{
"name": "toolora",
"private": true
}表格 (8)
基础表格
| Name | Age | | ---- | --- | | Alice | 30 | | Bob | 25 |
用管道符分列,必须有分隔行。
注意: GFM extension. CommonMark does not include tables.
| Name | Age |
|---|---|
| Alice | 30 |
| Bob | 25 |
对齐表格
| Left | Center | Right | | :--- | :----: | ----: | | a | b | c |
分隔行用 `:` 控制对齐:`:---` 左,`:---:` 居中,`---:` 右。
| Left | Center | Right |
|---|---|---|
| a | b | c |
表格内行内格式
| Name | Link | | ---- | ---- | | **bold** | [site](https://x.com) |
单元格支持行内格式:加粗、斜体、链接、行内代码。
注意: Block content (lists, fenced code) is NOT allowed in pipe-table cells.
| Name | Link |
|---|---|
| bold | site |
单元格内管道符
| Name | Code | | ---- | ---- | | or | a \| b |
`\|` 表示字面管道符。
| Name | Code |
|---|---|
| or | a | b |
列数不齐的表格
| A | B | C | | - | - | - | | 1 | 2 | | 1 | 2 | 3 | 4 |
行不够的列补空,多出来的列被丢弃。
| A | B | C | |
|---|---|---|---|
| 1 | 2 | ||
| 1 | 2 | 3 | 4 |
最简分隔行
| A | B | | - | - | | 1 | 2 |
分隔行每列一个 `-` 就够了。
| A | B |
|---|---|
| 1 | 2 |
省略首尾管道的表格
A | B --- | --- 1 | 2
GFM 表格里首尾的 `|` 可省略。
| A | B |
|---|---|
| 1 | 2 |
单元格内换行
| Item | Notes | | ---- | ----- | | A | line1<br>line2 |
单元格内换行用 `<br>`,直接敲回车不行。
| Item | Notes |
|---|---|
| A | line1<br>line2 |
块引用 (6)
块引用
> This is a quote. > Wrapped onto a second line.
每行前面加 `>`。
This is a quote. Wrapped onto a second line.
嵌套块引用
> Outer quote > > Inner quote > back to outer
`> >` 表嵌套。
Outer quote > Inner quote back to outer
引用内含格式
> ## Quoted heading > > Paragraph with **bold**. > > - list item
块引用内可包含任何 Markdown 块级元素。
## Quoted heading Paragraph with bold. - list item
惰性块引用续行
> First line still the same quote
紧跟 `>` 行之后的行,即使没有 `>` 也并入同一引用。
First line
still the same quote
引用内代码块
> Run this: > > ```sh > npm ci > ```
围栏代码每行都加 `>`,才留在引用内。
Run this: ```sh npm ci ```
GitHub 提示框
> [!NOTE] > Useful information. > [!WARNING] > Be careful here.
GitHub 把 `[!NOTE]`、`[!TIP]`、`[!IMPORTANT]`、`[!WARNING]`、`[!CAUTION]` 渲染成彩色提示框。
注意: GitHub-specific. Other renderers show a plain blockquote.
[!NOTE] Useful information.
[!WARNING] Be careful here.
HTML (10)
行内 HTML
Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to copy.
行内 HTML 标签原样透传。
Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to copy.
块级 HTML
<details> <summary>Click to expand</summary> Hidden content. </details>
块级 HTML 原样透传。常用于 `<details>`、`<table>`。
注意: Many renderers sanitize away <script>, <style>, <iframe>, on* handlers.
Click to expand
Hidden content.
</details>
HTML 注释
<!-- This is a comment, not rendered. -->
HTML 注释会被剥掉,不渲染。常用作 TODO 标注。
上下标
H<sub>2</sub>O and E = mc<sup>2</sup>
Markdown 没有原生写法,用 `<sub>` 和 `<sup>`。
H<sub>2</sub>O and E = mc<sup>2</sup>
默认展开的折叠块
<details open> <summary>Shown expanded</summary> Content. </details>
给 `<details>` 加 `open` 属性,初始就是展开状态。
Shown expanded
Content.
</details>
HTML 块内的 Markdown
<div> **This is bold** inside a div. </div>
开标签后留空行,块内的 Markdown 才会被解析。
注意: Without the blank line, the inner text is treated as raw HTML.
This is bold inside a div.
</div>
显式换行标签
first line<br>second line
行内任意位置用 `<br>` 强制换行。
first line<br>second line
居中内容
<p align="center"> <img src="logo.png" width="120"> </p>
Markdown 没有居中语法,用 `<p align="center">` 或 `<div align="center">`。
手动锚点
<a id="top"></a> ... later: [back to top](#top)
空的 `<a id="...">` 可手动设跳转目标,自动 slug 不够用时好用。
... later: back to top
HTML 实体
Price: 5 USD — in stock © 2026
` `、`©`、`→` 这类命名或数字实体会原样输出。
Price: 5 USD — in stock © 2026
GFM 扩展 (12)
删除线
~~struck through~~
两边各两个 `~`。GFM 扩展。
注意: Not in CommonMark spec — GFM/GitLab/Bitbucket all support.
struck through
任务列表
- [ ] todo - [x] done - [ ] another
`- [ ]` 未完成,`- [x]` 已完成。GFM 扩展。
注意: GitHub/GitLab/Bitbucket render checkboxes; CommonMark renders as text.
- todo
- done
- another
GFM 自动链接
Just paste https://toolora.com — GFM auto-links.
GFM 扩展:裸 URL 不需要 `<>` 也自动变链接。
注意: CommonMark requires `<>`. GitHub/GitLab/Bitbucket auto-link without.
Just paste https://toolora.com — GFM auto-links.
脚注
Here is a claim.[^1] [^1]: Citation goes here.
行内引用 + 文末脚注定义。GFM/GitLab 支持。
注意: CommonMark does not include footnotes. Bitbucket does not support.
Here is a claim.[^1]
[^1]: Citation goes here.
GitHub @ 提及
cc @octocat please review
`@user` 自动变成用户链接。仅 GitHub 支持。
cc @octocat please review
Issue 引用
Fixes #42 and closes owner/repo#7
`#123`、`owner/repo#123` 自动链到 issue。GitHub/GitLab 支持。
Fixes #42 and closes owner/repo#7
Emoji 短码
I :heart: Markdown :sparkles:
`:名称:` 渲染为 emoji。GitHub 专属。
注意: Renders literally on non-GitHub viewers.
I :heart: Markdown :sparkles:
嵌套任务列表
- [x] parent done - [ ] child todo - [x] child done
子任务复选框缩进到父项下即可嵌套。
- parent done
- child todo
- child done
多个脚注
Claim one.[^a] Claim two.[^b] [^a]: First note. [^b]: Second note.
脚注标签可以是任意标识符,不只是数字,输出会按顺序重新编号。
Claim one.[^a] Claim two.[^b]
[^a]: First note. [^b]: Second note.
GFM www 自动链接
Visit www.toolora.com for tools.
GFM 自动识别裸 `www.` 域名,并补上 `http://`。
注意: CommonMark does not auto-link www-only hosts.
Visit www.toolora.com for tools.
提交 SHA 引用
Fixed in a1b2c3d and owner/repo@f4e5d6c
GitHub 自动链接 7 位以上的提交哈希,也支持 `owner/repo@sha`。
Fixed in a1b2c3d and owner/repo@f4e5d6c
Unicode emoji
Ship it 🚀 — works everywhere.
直接粘贴的 Unicode emoji 在所有查看器都能显示,不像 `:短码:`。
Ship it 🚀 — works everywhere.
方言 (13)
CommonMark
# Heading Paragraph with [link](url) and `code`.
最严格的基线规范。无表格、无任务列表、无删除线、无脚注。
Heading
Paragraph with link and code.
GitHub Flavored Markdown
CommonMark + tables + task lists + ~~strike~~ + autolinks + emoji + @mentions + #refs
CommonMark 超集。增加表格、任务列表、删除线、自动链接、emoji、@ 提及、#issue 引用。
CommonMark + tables + task lists + strike + autolinks + emoji + @mentions + #refs
GitLab Flavored Markdown
GFM + math via $...$ + diagrams + video/audio embeds
GFM 超集。增加 `$...$` 数学公式、mermaid 流程图、视频音频嵌入、MR 引用。
GFM + math via $...$ + diagrams + video/audio embeds
Bitbucket Markdown
CommonMark base + anchor prefix: #markdown-header-my-heading
接近 CommonMark。锚点用 `markdown-header-` 前缀,GFM 风格的文档内链接会失效。
CommonMark base + anchor prefix: #markdown-header-my-heading
标题锚点链接
See [Setup](#setup) below. ## Setup
标题自动生成 `id` slug,用 `#slug` 链接。各家 slug 规则不同。
See Setup below.
Setup
视频嵌入(GitLab)

GitLab 把视频格式渲染为 `<video>` 播放器。GitHub/Bitbucket 会渲染成坏图。
数学公式(GitLab)
Inline: $E = mc^2$
Block:
```math
\sum_{i=1}^n i = \frac{n(n+1)}{2}
```GitLab 支持 `$...$` 行内与 ` ```math ` 块。GitHub 从 2022 起也支持 `$...$`。
Inline: $E = mc^2$
Block:
\sum_{i=1}^n i = \frac{n(n+1)}{2}YAML front matter
--- title: My Post date: 2026-05-30 --- Body starts here.
Jekyll、Hugo、Astro、11ty 会读取 `---` 包裹的 YAML 块作为元数据。
注意: Plain CommonMark renders the first `---` as a horizontal rule.
title: My Post
date: 2026-05-30
Body starts here.
目录占位符
[[_TOC_]]
GitLab 在 `[[_TOC_]]` 处插入自动目录(部分平台用 `[TOC]`)。
注意: GitHub renders its own TOC from the file outline, no marker needed.
[[TOC]]
高亮文本
This is ==highlighted== text.
Obsidian、Pandoc 等把 `==text==` 渲染为 `<mark>`。GFM 不支持。
This is ==highlighted== text.
Wiki 风格链接
[[Page Name]] and [[Page Name|display text]]
Obsidian、GitHub wiki、DokuWiki 用 `[[...]]` 按页面标题链接。
注意: Not part of CommonMark or GFM document Markdown.
[[Page Name]] and [[Page Name|display text]]
Obsidian callout
> [!info] Title > Body of the callout.
Obsidian 用 `[!type]` 扩展块引用为 callout(info、tip、warning 等)。
[!info] Title Body of the callout.
空链接注释技巧
[//]: # (This is an invisible comment.)
未被使用的链接引用定义不会渲染,可当作跨平台注释。
[//]: # (This is an invisible comment.)
这个工具能做什么
免费在线 Markdown 语法速查表,50+ 条规则全部配实时预览:左边是 你需要写的源码,右边立刻看到渲染效果,再也不用复制到别处试。 覆盖:标题 / 加粗 / 斜体 / 删除线 / 有序与无序列表 / 嵌套列表 / 任务列表 / 行内链接 / 引用式链接 / 自动链接 / 图片 / 行内代码 / 围栏代码块(含语言提示)/ 表格(含对齐)/ 块引用 / 分割线 / 原始 HTML 嵌入 / 脚注。每条规则都标注 CommonMark、GitHub Flavored Markdown、GitLab、Bitbucket 这四种主流方言的支持情况,方言之间那些 让人抓狂的小差异(GFM 多了任务列表 / 删除线 / 自动链接 / 表格; GitLab 多了视频嵌入和数学公式;Bitbucket 的锚点前缀是 `markdown-header-`)都明确标出。点"复制"一键拷贝任意规则源码。 支持顶部搜索和分类筛选。100% 浏览器本地处理,不上传文档。
工具细节
- 输入
- 文本 + 数值 + 结构化内容
- 页面会根据工具类型展示文本框、数值控件、文件选择或结构化输入。
- 输出
- 即时结果 + 复制 + 预览
- 结果区优先给出可操作结果,支持项会显示复制、下载或可视化预览。
- 隐私
- 浏览器本地处理
- 主工具逻辑未发现外部 API 调用,输入通常留在当前标签页内处理。
- 保存 / 分享
- 免账号使用
- 打开页面即可使用;刷新后是否保留结果取决于具体工具。
- 性能预算
- 首屏 JS ≤ 22 KB
- 没有声明 WASM 依赖,适合快速打开和移动端使用。
- 适用场景
- 开发运维 · 程序员
- 分类和职业标签用于推荐相关工具、组织内链,并帮助用户快速判断是否适合当前任务。
怎么用
-
1. 输入
把内容粘贴或拖入工具面板。
-
2. 处理
点击按钮,在浏览器内本地处理,文件不上传。
-
3. 复制 / 下载
一键复制结果或下载到本地。
Markdown 速查表 适合怎么用
适合穿插在写代码、查问题、做 Review、上线前的小任务里。
适合开发场景
- 格式化、校验、压缩或检查和代码相关的文本。
- 把片段整理好再放进文档、工单、提交或交接材料。
- 不切换工具,快速检查一个小 payload。
开发检查项
- 压缩、混淆这类不可逆处理,先对副本操作。
- 除非确认工具本地处理,不要粘贴密钥和敏感片段。
- 转换后的代码上线前,仍要跑自己的测试或 lint。
下一步可以接着做
这些入口会把当前任务接到更完整的工具链里。
真实使用场景
修好在 PR 里渲染成一堆裸管道符的表格
你把一个 6 列的表格贴进 GitHub PR 描述,结果显示成字面的 `| 名称 | 值 |`。打开速查表找到表格那条,检查分隔行:每列必须正好 一个 `---` 单元格,而且表头上方得空一行。把能跑的骨架复制下来,换上 你的数据,diff 里立刻渲染干净。
写 README 徽章行又不弄坏图片语法
你想在 README 顶部并排放三个 shields.io 徽章,可总有一个显示成坏掉的 alt 文字。图片那条提醒你:行内图片是 ``,感叹号后面不能有 空格;给图片套链接是 `[](跳转地址)`。复制这个嵌套写法,三个 徽章贴成一行就对齐了。
文档从 GitHub 搬到 GitLab 后锚点链接全失效
同事把一份 40 页的 wiki 从 GitHub 迁到 GitLab,所有 `[跳转](#section-name)` 链接全点不动。方言对照那行告诉你:GitLab 保留 GFM 锚点,只有 Bitbucket 会加 `markdown-header-` 前缀。你确认这次是 GitHub 到 GitLab,锚点本该没问题,真正的元凶是某个标题被改了名。
教写手在价格文案里转义一个字面星号
内容同事打了 `*条款适用`,结果这行变成斜体,还把后面整段都吞了。你把 转义那条指给他:在星号前加反斜杠,`\*条款适用` 就能原样打出星号。同样 的招数能修文件名里的下划线,比如 `my\_file\_name`,不然 Markdown 会把 它当成强调。
常见踩坑
忘了在表格或列表上方空一行。`一段文字` 紧接着下一行就是表格,会被当成 一整段合并掉。两者之间加一个空行,各自就都正常渲染了。
在图片的感叹号后面加了空格,比如 `! [alt](url)`。这个空格会让它变成一个 前面带字面 `!` 的链接。写成 `` 不带空格才是真图片。
在列表里给围栏代码块多缩进了几个空格,结果围栏失配。三个反引号要和列表 项文字保持同一缩进,不要更深,否则结尾的围栏对不上,代码块就闭合不了。
隐私说明
你在实时预览框里输入的一切都在浏览器本地运行,不会离开你的设备。没有上传、 没有服务器往返,速查表也不会把你的文本写进 URL,所以你粘贴的内容不会出现在 可分享链接或浏览器历史里,只留在你自己这一个标签页。页面是纯静态的,加载完 之后断网也能用。
常见问题
类似工具组合
做你这行的人, 还会一起用这些。