Markdown Cheat Sheet
Inline styles, headings, lists, tables, code and platform extensions
63 syntax entries
**加粗**Inline basics渲染为加粗文字
Bold, using double asterisks or underscores.
*斜体*Inline basics渲染为斜体文字
Italic, using a single asterisk or underscore.
***粗斜体***Inline basics渲染为加粗且斜体
Bold and italic together.
~~删除线~~Inline basics文字中间加一条删除线
Strikethrough, a GFM extension not in CommonMark.
`行内代码`Inline basics灰底等宽文字
Inline code wrapped in single backticks.
**粗体里含*斜体***Inline basics嵌套行内样式
Inline styles can nest, but underscores are less error-prone.
Watch out: A space just inside the asterisks breaks it, so ** bold ** fails.
---Inline basics一条水平分割线
Thematic break: three or more hyphens, asterisks, or underscores.
Watch out: Directly under text, hyphens become a Setext heading; keep a blank line above.
\*Inline basics显示为字面星号
Backslash escape: the next character is taken literally.
Watch out: Only a fixed set of ASCII punctuation can be escaped.
行尾两个空格Inline basics强制换行,不产生新段落
Two trailing spaces force a line break.
Watch out: Trailing spaces are invisible and often stripped by formatters.
行尾反斜杠Inline basics强制换行,效果同上但可见
A trailing backslash forces a line break and stays visible.
Inline basics插入一个不折行空格
Raw HTML entities pass through untouched.
<!-- 注释 -->Inline basics渲染后不显示
Comment: absent from the rendered output.
# 一级标题Headings最大的标题
Headings 1 through 6; a space after the hashes is required.
Watch out: Without the space most parsers ignore it.
###### 六级标题Headings最小的标题
Level six; more than six hashes renders literally.
标题
===Headings上一行变成一级标题
Setext style: equals signs turn the line above into a level-one heading.
标题
---Headings上一行变成二级标题
Setext style with hyphens for a level-two heading.
{#custom-id}Headings给标题指定锚点 id
Custom heading id; not standard Markdown.
Watch out: GitHub generates anchors by lowercasing and hyphenating, dropping non-ASCII.
1. 有序项Lists带序号的一项
Ordered list: digits, a period, then a space.
1) 有序项Lists带序号的一项
Alternative ordered marker; not all parsers accept it.
- 一级
- 二级Lists缩进的子列表
Nested list: indent children by two to four spaces.
Watch out: Too little indent flattens the list; too much creates a code block.
- [ ] 待办Lists带空复选框的一项
Task list, unchecked (GFM extension).
- [x] 已完成Lists带勾选复选框的一项
Task list, checked; the x is case-insensitive.
- 列表项
第二段Lists同一项里的第二个段落
Multiple paragraphs in one item; align continuation with the item text.
- 列表项
```js
code
```Lists列表项里的代码块
A fenced code block inside a list item must be indented to the list content.
3. 从三开始Lists序号从三开始且后续递增
The first number is honored; later numbers are auto-incremented.
| 列 A | 列 B |Tables表头行
The first row is the header.
| --- | --- |Tables分隔行,必须有
The delimiter row is mandatory or it is not a table.
Watch out: Column counts must match the header or extra cells are dropped.
| :--- | ---: |Tables左对齐与右对齐
Colon placement sets alignment: left, right.
| :---: |Tables居中对齐
Colons on both sides center the column.
\|Tables显示为竖线字符
Escape a pipe to show it inside a cell.
<br>Tables单元格内换行
Use an HTML br for line breaks inside cells.
```jsCode带语法高亮的代码块
Fenced code block; naming the language turns on highlighting.
Watch out: Omitting the language usually means no highlighting.
~~~Code波浪号围栏代码块
Tilde fences, useful when the content contains backticks.
缩进四空格Code缩进式代码块
Indented code block, the legacy form.
`` `code` ``Code内层含反引号的行内代码
Use more backticks than the content contains.
[文本](https://example.com)Links and images一个超链接
Inline link.
[文本](https://example.com "标题")Links and images带悬停标题的链接
A link may carry a title shown on hover.
<https://example.com>Links and images自动识别为链接
Angle brackets turn a URL into a link automatically.
[文本][ref]
[ref]: https://example.comLinks and images引用式链接
Reference-style link, keeping long URLs at the bottom.
Links and images一张图片
Image syntax is a link with an exclamation mark.
Watch out: Never omit alt text; it is the only clue when the image fails.
[](https://example.com)Links and images点击图片跳转
An image wrapped in a link.
[标题](#自定义锚点)Links and images跳到页内某处
Jump within the page; the anchor rules come from the renderer.
[文本](./docs/other.md)Links and images跳到相对路径文件
Relative path link, clickable only where the platform supports it.
\[不是链接\]Links and images显示为字面方括号
Escape brackets that appear literally in link text.
> 引用内容Block quotes左侧带竖线的段落
Block quote; a space after the caret is conventional.
>> 嵌套引用Block quotes两级缩进的引用
Nested quote: add one caret per level.
>
> 第二段Block quotes引用里的第二个段落
A blank line inside a quote still needs the caret.
> ```js
> code
> ```Block quotes引用里的代码块
Every line of a code block inside a quote needs the caret.
> **注意**:内容Block quotes带强调的提示块
Quotes accept emphasis and other inline syntax.
> [!NOTE]Platform extensions带图标的提示块
GitHub alert block; also TIP, IMPORTANT, WARNING, CAUTION.
Watch out: Only works on GitHub and its derivatives; elsewhere it is a plain quote.
[^1]Platform extensions脚注标记
Footnote reference; define it at the bottom.
[^1]: 脚注内容Platform extensions脚注定义
Footnote definition; the label can be any identifier.
:smile:Platform extensions渲染为一个表情
Emoji shortcode, backed by the platform emoji table.
$E = mc^2$Platform extensions行内数学公式
Inline math, requiring MathJax or KaTeX.
Watch out: Most platforms render this literally unless math is enabled.
$$
E = mc^2
$$Platform extensions独立成行的公式
Block math, also renderer-dependent.
```mermaidPlatform extensions渲染成图表
Mermaid diagram; the platform must support it.
[[_TOC_]]Platform extensions渲染为目录
Auto table of contents, supported by GitLab and some wikis.
Watch out: Not supported on GitHub; it renders literally.
#123 / @userPlatform extensions渲染为可点击的引用
Issue references and mentions are platform features, not Markdown.
<br>Inline HTML强制换行
Raw HTML passes through on most platforms.
<details><summary>标题</summary>内容</details>Inline HTML可折叠区块
Collapsible block, handy for long logs.
Watch out: GitHub renders it but skips Markdown inside unless blank lines are used.
<img src="a.png" width="200">Inline HTML指定宽度的图片
HTML images accept attributes like width.
<kbd>Ctrl</kbd>Inline HTML键帽样式
Keyboard key styling, common in documentation.
Markdown 里的**粗体**与 <b>粗体</b>Inline HTML两种粗体写法都生效
Inline HTML and Markdown can mix.
Watch out: Block-level HTML needs blank lines around it or Markdown stops parsing inside.
Something broken or missing?
Send feedback