🖊️

Markdown

标题语法

在单词或短语前面添加井号 (#) 。#的数量代表了标题的级别
Markdown语法
HTML
# Heading level 1
<h1>Heading level 1</h1>
## Heading level 2
<h2>Heading level 2</h2>
### Heading level 3
<h3>Heading level 3</h3>
#### Heading level 4
<h4>Heading level 4</h4>
##### Heading level 5
<h5>Heading level 5</h5>
###### Heading level 6
<h6>Heading level 6</h6>
还可以在文本下方添加任意数量的 == 号来标识一级标题,或者 -- 号来标识二级标题。

换行语法

在一行的末尾添加两个或多个空格,然后按回车键,即可创建一个换行

强调语法

斜体

要用斜体显示文本,请在单词或短语前后添加一个星号(asterisk)或下划线(underscore)。要斜体突出单词的中间部分,请在字母前后各添加一个星号,中间不要带空格。
Markdown语法
HTML
预览效果
Italicized text is the *cat's meow*.
Italicized text is the <em>cat's meow</em>.
Italicized text is the cat’s meow.
Italicized text is the _cat's meow_.
Italicized text is the <em>cat's meow</em>.
Italicized text is the cat’s meow.
A*cat*meow
A<em>cat</em>meow
Acatmeow

粗体

要加粗文本,请在单词或短语的前后各添加两个星号(asterisks)或下划线(underscores)。如需加粗一个单词或短语的中间部分用以表示强调的话,请在要加粗部分的两侧各添加两个星号(asterisks)。
Markdown语法
HTML
预览效果
I just love **bold text**.
I just love <strong>bold text</strong>.
I just love bold text.
I just love __bold text__.
I just love <strong>bold text</strong>.
I just love bold text.
Love**is**bold
Love<strong>is</strong>bold
Loveisbold

粗体和斜体

要同时用粗体和斜体突出显示文本,请在单词或短语的前后各添加三个星号或下划线。要加粗并用斜体显示单词或短语的中间部分,请在要突出显示的部分前后各添加三个星号,中间不要带空格。
Markdown语法
HTML
预览效果
This text is ***really important***.
This text is <strong><em>really important</em></strong>.
This text is really important.
This text is ___really important___.
This text is <strong><em>really important</em></strong>.
This text is really important.
This text is __*really important*__.
This text is <strong><em>really important</em></strong>.
This text is really important.
This text is **_really important_**.
This text is <strong><em>really important</em></strong>.
This text is really important.
This is really***very***important text.
This is really<strong><em>very</em></strong>important text.
This is reallyveryimportant text.

引用语法

要创建块引用,请在段落前添加一个>符号。
块引用可以包含多个段落。为段落之间的空白行添加一个>符号。
块引用可以嵌套。在要嵌套的段落前添加一个>>符号。

列表语法

有序列表

要创建有序列表,请在每个列表项前添加数字并紧跟一个英文句点。数字不必按数学顺序排列,但是列表应当以数字 1 起始。
Markdown语法
HTML
预览效果
1. First item 2. Second item 3. Third item 4. Fourth item
<ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>
1. First item 2. Second item 3. Third item 4. Fourth item
1. First item 1. Second item 1. Third item 1. Fourth item
<ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>
1. First item 2. Second item 3. Third item 4. Fourth item
1. First item 5. Second item 6. Third item 7. Fourth item
<ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>
1. First item 2. Second item 3. Third item 4. Fourth item
1. First item 2. Second item 3. Third item 1. Indented item 2. Indented item 4. Fourth item
<ol><li>First item</li><li>Second item</li><li>Third item<ol><li>Indented item</li><li>Indented item</li></ol></li><li>Fourth item</li></ol>
1. First item 2. Second item 3. Third item 1. Indented item 2. Indented item 4. Fourth item

无序列表

要创建无序列表,请在每个列表项前面添加破折号 (-)、星号 (*) 或加号 (+) 。缩进一个或多个列表项可创建嵌套列表。
Markdown语法
HTML
预览效果
- First item - Second item - Third item - Fourth item
<ul><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ul>
First itemSecond itemThird itemFourth item
* First item * Second item * Third item * Fourth item
<ul><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ul>
First itemSecond itemThird itemFourth item
+ First item + Second item + Third item + Fourth item
<ul><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ul>
First itemSecond itemThird itemFourth item
- First item - Second item - Third item - Indented item - Indented item - Fourth item
<ul><li>First item</li><li>Second item</li><li>Third item<ul><li>Indented item</li><li>Indented item</li></ul></li><li>Fourth item</li></ul>
First itemSecond itemThird itemIndented itemIndented itemFourth item

代码语法

要将单词或短语表示为代码,请将其包裹在反引号 (`) 中。
Markdown语法
HTML
预览效果
At the command prompt, type `nano`.
At the command prompt, type <code>nano</code>.
At the command prompt, type nano.

转义反引号

如果你要表示为代码的单词或短语中包含一个或多个反引号,则可以通过将单词或短语包裹在双反引号(``)中。
Markdown语法
HTML
预览效果
``Use `code` in your Markdown file.``
<code>Use `code` in your Markdown file.</code>
Use `code` in your Markdown file.

代码块

要创建代码块,请将代码块的每一行缩进至少四个空格或一个制表符。
<html> <head> </head> </html>
渲染效果如下:
<html> <head> </head> </html>

围栏代码块

Markdown基本语法允许您通过将行缩进四个空格或一个制表符来创建代码块 。如果发现不方便,请尝试使用受保护的代码块。根据Markdown处理器或编辑器的不同,您将在代码块之前和之后的行上使用三个反引号(```)或三个波浪号(~~~)。

分隔线语法

要创建分隔线,请在单独一行上使用三个或多个星号 (***)、破折号 (---) 或下划线 (___) ,并且不能包含其他内容。

链接语法

链接文本放在中括号内,链接地址放在后面的括号中,链接title可选。
超链接Markdown语法代码:[超链接显示名](超链接地址 "超链接title")
对应的HTML代码:<a href="超链接地址" title="超链接title">超链接显示名</a>

给链接增加 Title

链接title是当鼠标悬停在链接上时会出现的文字,这个title是可选的,它放在圆括号中链接地址后面,跟链接地址之间以空格分隔。
这是一个链接 [Markdown语法](https://markdown.com.cn "最好的markdown教程")。

网址和Email地址

使用尖括号可以很方便地把URL或者email地址变成可点击的链接。
<https://markdown.com.cn> <[email protected]>

带格式化的链接

强调 链接, 在链接语法前后增加星号。 要将链接表示为代码,请在方括号中添加反引号。
I love supporting the **[EFF](https://eff.org)**. This is the *[Markdown Guide](https://www.markdownguide.org)*. See the section on [`code`](#code).
渲染效果如下:
I love supporting the EFF.
This is the Markdown Guide.
See the section on code.

图片语法

要添加图像,请使用感叹号 (!), 然后在方括号增加替代文本,图片链接放在圆括号里,括号里的链接后可以增加一个可选的图片标题文本。
插入图片Markdown语法代码:![图片alt](图片链接 "图片title")
对应的HTML代码:<img src="图片链接" alt="图片alt" title="图片title">
![这是图片](/assets/img/philly-magic-garden.jpg "Magic Gardens")

使用emoji表情

一些Markdown应用程序允许您通过键入表情符号短代码来插入表情符号。这些以冒号开头和结尾,并包含表情符号的名称。表情符号简码列表
去露营了! :tent: 很快回来。 真好笑! :joy:
呈现的输出如下所示:
去露营了!⛺很快回来。
真好笑!😂

删除线

您可以通过在单词中心放置一条水平线来删除单词。结果看起来像这样。此功能使您可以指示某些单词是一个错误,要从文档中删除。若要删除单词,请在单词前后使用两个波浪号~~
~~世界是平坦的。~~ 我们现在知道世界是圆的。
呈现的输出如下所示:
世界是平坦的。 我们现在知道世界是圆的。

表格

要添加表,请使用三个或多个连字符(---)创建每列的标题,并使用管道(|)分隔每列。您可以选择在表的任一端添加管道。
| Syntax | Description | | ----------- | ----------- | | Header | Title | | Paragraph | Text |
呈现的输出如下所示:
Syntax
Description
Header
Title
Paragraph
Text
单元格宽度可以变化,如下所示。呈现的输出将看起来相同。
| Syntax | Description | | --- | ----------- | | Header | Title | | Paragraph | Text |
Tip: 使用连字符和管道创建表可能很麻烦。为了加快该过程,请尝试使用Markdown Tables Generator。使用图形界面构建表,然后将生成的Markdown格式的文本复制到文件中。

对齐

您可以通过在标题行中的连字符的左侧,右侧或两侧添加冒号(:),将列中的文本对齐到左侧,右侧或中心。
| Syntax | Description | Test Text | | :--- | :----: | ---: | | Header | Title | Here's this | | Paragraph | Text | And more |
呈现的输出如下所示:
Syntax
Description
Test Text
Header
Title
Here’s this
Paragraph
Text
And more

任务列表语法

任务列表使您可以创建带有复选框的项目列表。在支持任务列表的Markdown应用程序中,复选框将显示在内容旁边。要创建任务列表,请在任务列表项之前添加破折号-和方括号[ ],并在[ ]前面加上空格。要选择一个复选框,请在方括号[x]之间添加 x 。
notion image
呈现的输出如下所示:
notion image

Markdown 脚注

脚注使您可以添加注释和参考,而不会使文档正文混乱。当您创建脚注时,带有脚注的上标数字会出现在您添加脚注参考的位置。读者可以单击链接以跳至页面底部的脚注内容。
要创建脚注参考,请在方括号([^1])内添加插入符号和标识符。标识符可以是数字或单词,但不能包含空格或制表符。标识符仅将脚注参考与脚注本身相关联-在输出中,脚注按顺序编号。
在括号内使用另一个插入符号和数字添加脚注,并用冒号和文本([^1]: My footnote.)。您不必在文档末尾添加脚注。您可以将它们放在除列表,块引号和表之类的其他元素之外的任何位置。
Here's a simple footnote,[^1] and here's a longer one.[^bignote] [^1]: This is the first footnote. [^bignote]: Here's one with multiple paragraphs and code. Indent paragraphs to include them in the footnote. `{ my code }` Add as many paragraphs as you like.
呈现的输出如下所示:
Here's a simple footnote,[^1] and here's a longer one.[^bignote]
[^1]: This is the first footnote.
[^bignote]: Here's one with multiple paragraphs and code.