Markdown 是一种轻量级的标记语言,可用于在纯文本文档中添加格式化元素。

Markdown 标题语法

要创建标题,请在单词或短语前面添加井号 (#) 。# 的数量代表了标题的级别。
不同的 Markdown 应用程序处理 # 和标题之间的空格方式并不一致。为了兼容考虑,在 # 和标题之间加一个空格进行分隔。

plaintext
1
2
3
// 最多支持 6级标题
# Heading level 1
###### Heading level 6

Markdown 换行语法

plaintext
1
2
// 换行可使用<br> 标签
<br>

Markdown 强调语法

  1. 加粗文本在单词或短语的前后各添加两个星号或下划线
  2. 斜体显示文本,请在单词或短语前后添加一个星号或下划线
  3. 同时用粗体和斜体突出显示文本,请在单词或短语的前后各添加三个星号或下划线。
plaintext
1
2
3
4
5
6
7
8
9
10
11
// 加粗
**Blod**
__Blod__

// 斜体
*Italic*
_Italic_

// 同时用粗体和斜体突出显示文本
***BlodItalic***
___BlodItalic___

Markdown 引用语法

  1. 创建块引用,请在段落前添加一个 > 符号
  2. 块引用可以嵌套。在要嵌套的段落前添加一个 >> 符号
  3. 带有其它元素的块引用:块引用可以包含其他 Markdown 格式的元素
    plaintext
    1
    2
    3
    4
    5
    6
    7
    // 引用
    > Dorothy followed her through many of the beautiful rooms in her castle.
    // 嵌套引用
    >> Dorothy followed her through many of the beautiful rooms in her castle.
    // 带有其它元素的块引用
    > - Revenue was off the chart.
    > *Everything* is going according to **plan**.

    Markdown 列表语法

  4. 有序列表:在每个列表项前添加数字并紧跟一个英文句点
  5. 无序列表:在每个列表项前面添加破折号 (-)、星号 (*) 或加号 (+)
plaintext
1
2
3
4
5
6
7
8
9
10
11
12
// 有序列表
1. first
2. second
1. Indented item
3. Third item

// 无序列表
- Item
* Item
+ Item
- Indented item
- Item

Markdown 代码语法

  1. 要将单词或短语表示为代码,请将其包裹在反引号 (`) 中。
  2. 转义反引号:可以通过将单词或短语包裹在双反引号(``)中。
  3. 围栏代码块:在代码块之前和之后的行上使用三个反引号(```)或三个波浪号(~~~)。
  4. 语法高亮:在第一个三个反引号或三个波浪号后面写上对应的编程语言
    plaintext
    1
    2
    3
    4
    // 将单词表示为代码
    At the command prompt, type `nano`.
    // 转义反引号
    ``Use `code` in your Markdown file.``

// 代码语法高亮

javascript
1
console.log('china!')

Markdown 分隔线语法

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

plaintext
1
2
3
4
// 分隔线
***
---
___

Markdown 链接语法

  1. 链接文本放在中括号内,链接地址放在后面的括号中,链接title可选
  2. 网址和Email地址:使用尖括号可以很方便地把URL或者email地址变成可点击的链接
    plaintext
    1
    2
    3
    4
    5
    // 链接写法
    [超链接显示名](超链接地址 "超链接title")
    // 网址和Email地址
    <https://markdown.com.cn>
    <fake@example.com>

Markdown 图片语法

  1. 添加图像,请使用感叹号 (!), 然后在方括号增加替代文本,图片链接放在圆括号里,括号里的链接后可以增加一个可选的图片标题文本
  2. 链接图片:给图片增加链接,将图像的Markdown 括在方括号中,然后将链接添加在圆括号中
    plaintext
    1
    2
    3
    4
    // 普通图片
    ![图片alt](图片链接 "图片title")
    // 链接图片
    [![图片alt](图片链接 "图片title")](https://example.com)

    Markdown 表格

  3. 基础表格:使用三个或多个连字符(—-)创建每列的标题,并使用管道(|)分隔每列。
  4. 表格对齐:在标题行中的连字符的左侧,右侧或两侧添加冒号(:),将列中的文本对齐到左侧,右侧或中心。
plaintext
1
2
3
4
5
6
7
8
9
10
11
// 基础表格
| Syntax | Description |
| --------- | ----------- |
| Header | Title |
| Paragraph | Text |

// 对齐
| Syntax | Description | Test Text |
| :----- | :---------: | ----------: |
| Header | Title | Here's this |
| left | middle | right |

Markdown 脚注

在方括号(1)内添加插入符号和标识符。标识符可以是数字或单词,但不能包含空格或制表符。

plaintext
1
2
// 脚注
[^1]: This is the first footnote.

Markdown 定义列表

第一行上键入术语。在下一行,键入一个冒号,后跟一个空格和定义。

plaintext
1
2
Term
: This is the definition of the first term.

Markdown 删除线

删除单词,在单词前后使用两个波浪号~~

plaintext
1
2
// 删除线
~~Deleted~~ not deleted

Markdown 任务列表语法

在任务列表项之前添加破折号-和方括号[ ],并在[ ]前面加上空格。要选择一个复选框,请在方括号[x]之间添加 x 。

plaintext
1
2
3
// 任务列表
- [x] Write the press release
- [ ] Update the website

Markdown 使用 Emoji 表情

符号简码:以冒号开头和结尾,并包含表情符号的名称

plaintext
1
2
去露营了! :tent: 很快回来。
真好笑! :joy:

Markdown 数学公式【KaTeX】

可视化公式编辑器

MathType: 可视化公式编辑器 APP