免费注册
流程类
图形化表达方式
脑图类
结构化表达方式
笔记类
高效化表达方式
实用工具
实用工具
业务与管理领域
软件工程与系统设计
UML
数据分析与研究
工程与技术设计
数据库与信息系统
树形图
括号图
思维笔记

Markdown语法大全

Markdown标准语法

标题

要创建标题,请#在单词或短语的前面添加数字符号()。您使用的数字符号的数量应与标题级别相对应。例如,要创建标题级别三(<h3>),请使用三个数字符号(例如### My Header)。

Markdown 渲染输出
# Heading level 1

Heading level 1

## Heading level 2

Heading level 2

### Heading level 3

Heading level 3

#### Heading level 4

Heading level 4

##### Heading level 5
Heading level 5
###### Heading level 6
Heading level 6

替代语法

或者,在文本下方的行上,添加任意数量的==标题级别1的--字符或标题级别2的字符。

Markdown 渲染输出
Heading level 1 ===============

Heading level 1

Heading level 2 ---------------

Heading level 2

段落

要创建段落,请使用空白行分隔一行或多行文本。您不应缩进带有空格或制表符的段落。

Markdown 渲染输出
I really like using Markdown. I think I'll use it to format all of my documents from now on.

I really like using Markdown.

I think I'll use it to format all of my documents from now on.

换行

要创建换行符(<br>),请以两个或多个空格结束一行,然后键入return。

Markdown 渲染输出
This is the first line. And this is the second line.

This is the first line.
And this is the second line.

着重

您可以通过使文本变为粗体或斜体来增加着重。

粗体

要加粗文本,请在单词或短语的前后添加两个星号或下划线。要加粗一个单词的中部以强调,请在字母周围添加两个星号,且各空格之间不加空格。

Markdown 渲染输出
I just love **bold text**.

I just love bold text.

I just love __bold text__.

I just love bold text.

Love **is** bold Love is bold

斜体

要斜体显示文本,请在单词或短语的前后添加一个星号或下划线。要斜体突出单词的中间部分,请在字母周围添加一个星号,中间不要带空格。

Markdown 渲染输出
Italicized text is the *cat's meow*.

Italicized text is the cat's meow.

Italicized text is the _cat's meow_.

Italicized text is the cat's meow.

A *cat* meow A cat meow

粗体和斜体

Markdown 渲染输出
This text is ***really important***.

This text is really important.

This text is ___really important___.

This text is really important.

This text is __*really important*__.

This text is really important.

This text is **_really important_**.

This text is really important.

块引用

要创建blockquote,请在段落前面添加一个>。

代码:
                            
                                > Dorothy followed her through many of the beautiful rooms in her castle.
                            
                        

呈现的结果如下

Dorothy followed her through many of the beautiful rooms in her castle.

具有多个段落的块引用

块引用可以包含多个段落。>在段落之间的空白行上添加一个。

代码:
                            
                                > Dorothy followed her through many of the beautiful rooms in her castle.
>
> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
                            
                        

呈现的输出如下所示

Dorothy followed her through many of the beautiful rooms in her castle.

The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

代码:
                            
                                > Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
                            
                        

Dorothy followed her through many of the beautiful rooms in her castle.

The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

具有其他元素的块引用

块引用可以包含其他Markdown格式的元素。并非所有元素都可以使用-您需要进行实验以查看哪些元素有效。

代码:
                            
                                > #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
>  *Everything* is going according to **plan**.
                            
                        

呈现的输出如下所示:

The quarterly results look great!

  • Revenue was off the chart.
  • Profits were higher than ever.
Everything is going according to plan.

清单

您可以将项目组织成有序和无序列表。

有序列表

要创建有序列表,请在订单项中添加数字和句点。数字不必按数字顺序排列,但列表应以数字开头。

Markdown 渲染输出
1. First item 2. Second item 3. Third item 4. Fourth item
  1. First item
  2. Second item
  3. Third item
  4. Fourth item
1. First item 1. Second item 1. Third item 1. Fourth item
  1. First item
  2. Second item
  3. Third item
  4. Fourth item
1. First item 8. Second item 3. Third item 5. Fourth item
  1. First item
  2. Second item
  3. Third item
  4. Fourth item
1. First item 8. Second item 3. Third item 5. Fourth item
  1. First item
  2. Second item
  3. Third item
  4. Fourth item
1. First item 8. Second item 3. Third item 5. Fourth item
  1. First item
  2. Second item
  3. Third item
    1. Indented item
    2. Indented item
  4. Fourth item

无序列表

要创建无序列表,请在订单项前添加破折号(-),星号(*)或加号(+)。缩进一个或多个项目以创建嵌套列表。

Markdown 渲染输出
- First item - Second item - Third item - Fourth item
  • First item
  • Second item
  • Third item
  • Fourth item
* First item * Second item * Third item * Fourth item
  • First item
  • Second item
  • Third item
  • Fourth item
+ First item * Second item - Third item + Fourth item
  • First item
  • Second item
  • Third item
  • Fourth item
- First item - Second item - Third item - Indented item - Indented item - Fourth item
  • First item
  • Second item
  • Third item
    • Indented item
    • Indented item
  • Fourth item

在列表中添加元素

要在保留列表连续性的同时在列表中添加另一个元素,请将该元素缩进四个空格或一个制表符,如以下示例所示。

段落

代码:
                            
                                *   This is the first list item.
*   Here's the second list item.

    I need to add another paragraph below the second list item.

*   And here's the third list item.
                            
                        

呈现的输出如下所示:

  • This is the first list item.
  • Here's the second list item.
  • I need to add another paragraph below the second list item.

  • And here's the third list item.

块引用

代码:
                            
                                *   This is the first list item.
*   Here's the second list item.

    > A blockquote would look great below the second list item.

*   And here's the third list item.
                            
                        

呈现的输出如下所示:

  • This is the first list item.
  • Here's the second list item.
  • A blockquote would look great below the second list item.

  • And here's the third list item.

代码块

代码块通常缩进四个空格或一个制表符。当它们在列表中时,将它们缩进八个空格或两个选项卡。

代码:
                            
                                1.  Open the file.
2.  Find the following code block on line 21:

        <html>
            <head>
            <title>Test</title>
        </head>

3.  Update the title to match the name of your website.
                            
                        

呈现的输出如下所示:

1. Open the file.

2. Find the following code block on line 21:

<html> <head> <title>Test</title> </head>

3. Update the title to match the name of your website.

图片

代码:
                            
                                1. Welcome to use ProcessOn
2. Free flowcharts are available for you trail
    ![ProcessOn流程图支持插入多形式组件](../../flow/chart.png)
                            
                        

呈现的输出如下所示:

1. Welcome to use ProcessOn

2. Free flowcharts are available for you trail

ProcessOn流程图支持插入多形式组件

代码

要将单词或短语表示为代码,请将其括在勾号(`)中。

Markdown 渲染输出
At the command prompt, type `nano`. At the command prompt, type nano.

转义刻度线

如果要表示为代码的单词或短语包含一个或多个刻度线,可以通过将单词或短语括在双刻度线(``)中来对其进行转义。

Markdown 渲染输出
Use `code` in your Markdown file. Use code in your Markdown file.

代码块

要创建代码块,请在代码块的每一行缩进至少四个空格或一个制表符。

代码:
                            
                                <html>
      <head>
      </head>
    </html>
                            
                        

呈现的输出如下所示:

代码:
                            
                                <html>
  <head>
  </head>
</html>
                            
                        

水平线

要创建水平线***,请单独在一行上使用三个或更多的星号(),破折号(---)或下划线(___)。

代码:
                            
                                ***

---

_________________
                            
                        

所有这三个的渲染输出看起来都相同:

链接

要创建链接,请将链接文本括在方括号(例如[ProcessOn])中,然后立即在URL后面加上括号(例如(https://www.processon.com))中的URL 。

代码:
                            
                                Click to go to [ProcessOn](https://www.processon.com).
                            
                        

呈现的输出如下所示:

Click to go to ProcessOn

添加标题

您可以选择为链接添加标题。当用户将鼠标悬停在链接上时,这将显示为工具提示。要添加标题,请将其括在URL后面的括号中。

代码:
                            
                                Click to go to [ProcessOn](https://www.processon.com "Use ProcessOn for free").
                            
                        

呈现的输出如下所示:

Click to go to ProcessOn

网址和电子邮件地址

要将URL或电子邮件地址快速转换为链接,请将其括在尖括号中。

代码:
                            
                                <https://www.processon.com>
<support@processon.com>
                            
                        

呈现的输出如下所示:

https://www.processon.com
support@processon.com

格式化链接

为了强调链接,请在方括号和括号之前和之后添加星号。

代码:
                            
                                I love supporting the **[ProcessOn-Mermaid](https://www.processon.com/mermaid)**.
I want to use *[Mermaid](https://www.processon.com/mermaid)*.
                            
                        

呈现的输出如下所示:

I love supporting the ProcessOn-Mermaid

I want to use Mermaid

参考样式链接

引用样式链接是一种特殊的链接,它使URL在Markdown中更易于显示和阅读。引用样式的链接分为两部分:与文本保持内联的部分以及在文件中其他位置存储的部分,以使文本易于阅读。

格式化链接的第一部分

参考样式链接的第一部分使用两组括号进行格式化。第一组方括号包围应显示为链接的文本。第二组括号显示了一个标签,该标签用于指向您存储在文档其他位置的链接。

尽管不是必需的,但您可以在第一组和第二组支架之间包含一个空格。第二组括号中的标签不区分大小写,可以包含字母,数字,空格或标点符号。

这意味着以下示例格式对于链接的第一部分大致相同:

  • [Markdown][1]
  • [Markdown] [1]

格式化链接的第二部分

    标签放在方括号中,后紧跟冒号和至少一个空格(例如[label]: )。,链接的URL,您可以选择将其括在尖括号中。,链接的可选标题,您可以将其括在双引号,单引号或括号中。

这意味着以下示例格式对于链接的第二部分几乎都是等效的:

  • [1]: https://www.processon.com/markdown
  • [1]: https://www.processon.com/markdown "ProcessOn Markdown"
  • [1]: https://www.processon.com/markdown 'ProcessOn Markdown'
  • [1]: https://www.processon.com/markdown (ProcessOn Markdown)
  • [1]: <https://www.processon.com/markdown> "ProcessOn Markdown"
  • [1]: <https://www.processon.com/markdown> 'ProcessOn Markdown'
  • [1]: <https://www.processon.com/markdown> (ProcessOn Markdown)

您可以将链接的第二部分放在Markdown文档中的任何位置。有些人将它们放在出现的段落之后,而其他人则将它们放在文档的末尾(例如尾注或脚注)。

将零件放在一起的示例

假设您添加一个URL作为到段落的标准URL链接,并且在Markdown中看起来像这样:

代码:
                            
                                [Markdown在线编辑器](https://www.processon.com/markdown "ProcessOn Markdown")是ProcessOn推出的免费Markdown编辑器网页版,支持Markdown语法在线转换和生成,支持AI一键生成Markdown格式代码,还能导出ppt、图片等多种格式,满足多样需求。
                            
                        

尽管它可能指向有趣的附加信息,但显示的URL确实不会给现有的原始文本增加太多,除了使其难以阅读之外。要解决此问题,您可以改为设置网址格式:

代码:
                            
                                [Markdown在线编辑器][1]是ProcessOn推出的免费Markdown编辑器网页版,支持Markdown语法在线转换和生成,支持AI一键生成Markdown格式代码,还能导出ppt、图片等多种格式,满足多样需求。

[1]: <https://www.processon.com/markdown> "ProcessOn Markdown"
                            
                        

在上述两种情况下,呈现的输出将相同:

Markdown在线编辑器是ProcessOn推出的免费Markdown编辑器网页版,支持Markdown语法在线转换和生成,支持AI一键生成Markdown格式代码,还能导出ppt、图片等多种格式,满足多样需求。

链接HTML为

代码:
                            
                                <a href="https://www.processon.com/markdown" title="ProcessOn Markdown">Markdown在线编辑器</a>
                            
                        

图片

要添加图像,请添加感叹号(!),然后在括号中添加替代文本,并在括号中添加图像资源的路径或URL。您可以选择在括号中的URL之后添加标题。

代码:
                            
                                ![ProcessOn思维导图拥有海量思维导图模板](../../assets/mind/free_template.png "ProcessOn思维导图拥有海量思维导图模板")
                            
                        

呈现的输出如下所示:

ProcessOn思维导图拥有海量思维导图模板

链接图像

要向图像添加链接,请将图像的Markdown括在方括号中,然后在括号中添加链接。

代码:
                            
                                [![ER图在线协作](../../assets/er/online_collaboration.png) "ER图在线协作")](https://www.processon.com/er)
                            
                        

呈现的输出如下所示:

ER图在线协作

转义字符

要显示原义字符,否则将用于设置Markdown文档中的文本格式,请在字符前面添加反斜杠()。

代码:
                            
                                \* Without the backslash, this would be a bullet in an unordered list.
                            
                        

呈现的输出如下所示:

* 如果没有反斜杠,这将是无序列表中的项目符号。

你可以转义的字符

您可以使用反斜杠转义以下字符。

字符 名称
\ 反斜杠
` 刻度线
* 星号
_ 下划线
{} 大括号
[] 中括号
() 括号
# 井号
+ 加号
- 减号(连字符)
.
! 感叹号
| 管道

Markdown高级语法

表格

要添加表,请使用三个或多个连字符(---)创建每列的标题,并使用管道(|)分隔每列。您可以选择在表的任一端添加管道。

代码:
                            
                                | Syntax      | Description |
| ----------- | ----------- |
| Header      | Title       |
| Paragraph   | Text        |
                            
                        

呈现的输出如下所示:

Syntax Description
Header Title
Paragraph Text

元宽度可以变化,如下所示。呈现的输出将看起来相同。

代码:
                            
                                | Syntax | Description |
| --- | ----------- |
| Header | Title |
| Paragraph | Text |
                            
                        

对齐

您可以通过:在标题行内的连字符的左侧,右侧或两侧添加一个冒号(),以使列中的文本左,右或居中对齐。

代码:
                            
                                | 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

格式化表格中的文字

您可以格式化表格中的文本。例如,您可以添加链接,代码(`仅在刻度线()中显示单词或短语,而不能在代码块中添加)和强调。

您不能添加标题,块引用,列表,水平规则,图像或HTML标签。

在表中转义管道字符

您可以|使用表格的HTML字符代码(|)在表中显示竖线()字符。

围栏代码块

Markdown基本语法允许您通过将行缩进四个空格或一个制表符来创建代码块。

代码:
                            
                                ```
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25
}
```
                            
                        

呈现的输出如下所示:

代码:
                            
                                {
  "firstName": "John",
  "lastName": "Smith",
  "age": 25
}
                            
                        

语法高亮

许多Markdown处理器都支持围栏代码块的语法突出显示。此功能使您可以为代码编写时使用的任何语言添加颜色突出显示。要添加语法突出显示,请在受防护的代码块之前的对号旁指定一种语言。

代码:
                            
                                ```json
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25
}
```
                            
                        

呈现的输出如下所示:

代码:
                            
                                {
  firstName: "John",
  lastName: "Smith",
  age: 25
}
                            
                        

脚注

脚注使您可以添加注释和参考,而不会使文档正文混乱。创建脚注时,带有脚注引用的链接将出现带有链接的上标编号。读者可以单击链接跳至页面底部的脚注内容。

要创建脚注参考,请在方括号([^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.[2]

  1. This is the first footnote. ↩︎

  2. 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.↩︎

标题编号

许多Markdown处理器支持标题的自定义ID-一些Markdown处理器会自动添加它们。添加自定义的ID,您可以直接链接到标题,并用CSS修改。要添加自定义标题ID,请在与标题相同的行上用大括号括起该自定义ID。

代码:
                            
                                ### My Great Heading {#custom-id}
                            
                        

HTML看起来像这样:

代码:
                            
                                <h3 id="custom-id">My Great Heading</h3>
                            
                        

链接到标题ID

通过创建带有数字符号()和自定义标题ID 的标准链接,可以链接到文件中具有自定义ID #的标题。

Markdown 渲染输出
[标题编号](#15) <a href="#15">标题编号</a>

通过将自定义标题ID添加到网页的完整URL(例如,[标题编号](http://www.processon.com/markdown_format#15))。

定义清单

一些Markdown处理器允许您创建自定义列表和术语及其相应的定义。要创建定义列表,请在第一行上键入术语。下一行,键入一个冒号后跟一个空格和定义。

代码:
                            
                                First Term
: This is the definition of the first term.

Second Term
: This is one definition of the second term.
: This is another definition of the second term.
                            
                        

HTML看起来像这样:

代码:
                            
                                <dl>
  <dt>First Term</dt>
  <dd>This is the definition of the first term.</dd>
  <dt>Second Term</dt>
  <dd>This is one definition of the second term. </dd>
  <dd>This is another definition of the second term.</dd>
</dl>
                            
                        

呈现的输出如下所示:

First Term
This is the definition of the first term.
Second Term
This is one definition of the second term.
This is another definition of the second term.

删除线

您可以通过在单词中心放置一条水平线来“删除”单词。结果看起来像这样。此功能使您可以指示某些单词是一个错误,并不表示要包含在文档中。若要删除单词,请~~在单词前后使用两个波浪号()。

代码:
                            
                                ~~The world is flat.~~ We now know that the world is round.
                            
                        

呈现的输出如下所示:

The world is flat. We now know that the world is round.

任务清单

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

代码:
                            
                                - [x] Write the press release
- [ ] Update the website
- [ ] Contact the media
                            
                        

呈现的输出如下所示:

Write the press release

Update the website

Contact the media

自动网址链接

许多Markdown处理器会自动将URL转换为链接。这意味着如果您输入http://www.processon.com,即使您没有使用方括号,您的Markdown处理器也会自动将其转换为链接。

代码:
                            
                                https://www.processon.com
                            
                        

呈现的输出如下所示:

https://www.processon.com

禁用自动URL链接

如果您不希望自动链接URL,则可以通过将URL表示为带有刻度线的代码来删除该链接。

代码:
                            
                                `https://www.processon.com`
                            
                        

呈现的输出如下所示:

https://www.processon.com