I. 基本语法

1.1 文本样式

style语法示例输出
加粗** **__ __**这是粗体文本**这是粗体文本
斜体* *_ _*这是斜体文本*这是斜体文本
删除线~~ ~~~~这是错误文本~~这是错误文本
粗体和嵌入的斜体** **_ _**粗体嵌入_斜体_的文本**粗体嵌入_斜体_的文本
全部粗体和斜体*** ******全部粗体和斜体***全部粗体和斜体
下标<sub> </sub>这是<sub>下标</sub>文本这是下标文本
上标<sup> </sup>这是<sup>上标</sup>文本这是上标文本

1.2 引用文本

可以使用 > 来引用文本。

1> Text that is a quote

预览效果👇

Text that is a quote

1.3 引用代码

1.3.1 代码片段

1Use `git status` to list all new or modified files that haven't yet been committed.

预览效果👇

Use git status to list all new or modified files that haven’t yet been committed.

1.3.2 代码块

将在代码块之前之后的行上使用三个反引号👇

1Some basic Git commands are:
2```
3git status
4git add
5git commit
6```

1.3.3 隔离代码块

要在围栏代码块中显示三重倒引号,请将其包在四个倒引号内。

1```
2Look! You can see my backticks.
3```

1.4 链接

1This site was built using [GitHub Pages](https://pages.github.com/).

效果预览👇

This site was built using GitHub Pages .

1.5 图像

1![Screenshot of a comment on a GitHub issue showing an image, added in the Markdown, of an Octocat smiling and raising a tentacle.](https://myoctocat.com/assets/images/base-octocat.svg)

效果预览👇

Screenshot of a comment on a GitHub issue showing an image, added in the Markdown, of an Octocat smiling and raising a tentacle.

1.6 列表

1.6.1 无序列表

1- George Washington
2- John Adams
3- Thomas Jefferson

效果预览👇

  • George Washington
  • John Adams
  • Thomas Jefferson

1.6.2 有序列表

11. James Madison
22. James Monroe
33. John Quincy Adams

效果预览👇

  1. James Madison
  2. James Monroe
  3. John Quincy Adams

1.7 任务列表

1- [x] #739
2- [ ] https://github.com/octo-org/octo-repo/issues/740
3- [ ] Add delight to the experience when all tasks are complete :tada:
  • 任务一
  • 任务二
  • 任务三

如果任务列表项说明以括号开头,则需要使用 \ 进行转义:

1- [ ] \(Optional) Open a followup issue

效果预览👇

  • (Optional) Open a followup issue

1.8 段落

通过在文本行之间留一个空白行,可创建新段落。

1.9 脚注

1Here is a simple footnote[^1].  
2A footnote can also have multiple lines[^2].  
3
4[^1]: My reference.  
5[^2]: To add line breaks within a footnote, prefix new lines with 2 spaces.
6  This is a second line.  

效果预览👇

Here is a simple footnote1. A footnote can also have multiple lines2.

1.10 警报

只有在对用户成功至关重要时才使用警报,并将每篇文章的警报限制在一到两个,以防止读者负担过重。 此外,应避免连续发出警报。 警报无法嵌套在其他元素中。

 1> [!NOTE]
 2> Useful information that users should know, even when skimming content.
 3
 4> [!TIP]
 5> Helpful advice for doing things better or more easily.
 6
 7> [!IMPORTANT]
 8> Key information users need to know to achieve their goal.
 9
10> [!WARNING]
11> Urgent info that needs immediate user attention to avoid problems.
12
13> [!CAUTION]
14> Advises about risks or negative outcomes of certain actions.

效果预览👇

[!NOTE] Useful information that users should know, even when skimming content.

[!TIP] Helpful advice for doing things better or more easily.

[!IMPORTANT] Key information users need to know to achieve their goal.

[!WARNING] Urgent info that needs immediate user attention to avoid problems.

1.11 表情符号

EmojiNameComment
👆反手食指向上指
👇反手食指向下指
👈反手食指向左指
👉反手食指向右指
🫰食指与拇指交叉的手
💡灯泡提示/技巧 [tip]
📢喇叭注意 [notice]
⚠️警告警告 [warning]
星星收藏夹 [favorite]
🔍左斜的放大镜
勾号按钮
叉号按钮
叉号失败/错误 [failure/error]
✔️勾号成功/正确 [success/correct]
📌图钉说明 [explain]
红色问号问题 [question]
红色感叹号建议 [advise]
ℹ️信息信息 [info]
📓笔记本笔记 [note]
高压危险 [danger]
✌️胜利手势
🤏捏合的手势
🎯正中靶心的飞镖摘要 [abstract]
🐛毛毛虫Bug [bug]
📖打开的书本引用 [quote]
🪜梯子
🪧标语牌示例 [Example]
🔖书签书签 [bookmark]

II. 高级语法

2.1 表格

2.1.1 创建表

可以使用竖线 | 和连字符 - 创建表。 连字符用于创建每列的标题,而竖线用于分隔每列。 必须在表格前包含空白链接,以便其正确呈现。

1| Command | Description |
2| --- | --- |
3| git status | List all new or modified files |
4| git diff | Show file differences that haven't been staged |

表格末尾的竖线可选。

单元格的宽度可以不同,无需在列内准确对齐。 标题行的第一列中必须至少有三个横线。

效果预览👇

CommandDescription
git statusList all new or modified files
git diffShow file differences that haven’t been staged

2.1.2 格式化表格中的内容

可以在表格中使用格式,例如链接、内联代码块和文本样式:

1| Command | Description |
2| --- | --- |
3| `git status` | List all *new or modified* files |
4| `git diff` | Show file differences that **haven't been** staged |

效果预览👇

CommandDescription
git statusList all new or modified files
git diffShow file differences that haven’t been staged

可以通过在标题行中连字符的左侧、右侧或两侧添加冒号 :,来靠左、靠右或居中对齐列中的文本。

1| Left-aligned | Center-aligned | Right-aligned |
2| :---         |     :---:      |          ---: |
3| git status   | git status     | git status    |
4| git diff     | git diff       | git diff      |

效果预览👇

Left-alignedCenter-alignedRight-aligned
git statusgit statusgit status
git diffgit diffgit diff

若要包含竖线 | 作为单元格中的内容,请在竖线前使用 \

1| Name     | Character |
2| ---      | ---       |
3| Backtick | `         |
4| Pipe     | \|        |

效果预览👇

NameCharacter
Backtick`
Pipe|

2.2 折叠

<details> 块中的任何 Markdown 都将被折叠,直到读者单击 展开详细信息。

<details> 块中,使用 <summary> 标记让读者知道里面的内容。 标签显示在 的右侧。

 1<details>
 2
 3<summary>Tips for collapsed sections</summary>
 4
 5### You can add a header
 6
 7You can add text within a collapsed section. 
 8
 9You can add an image or a code block, too.
10
11```ruby
12   puts "Hello World"
13```
14
15</details>

2.3 Mermaid 关系图

1```mermaid
2graph TD;
3    A-->B;
4    A-->C;
5    B-->D;
6    C-->D;
7```

效果预览👇

1graph TD;
2    A-->B;
3    A-->C;
4    B-->D;
5    C-->D;

2.4 数学表达式

2.4.1 内联表达式

1This sentence uses `$` delimiters to show math inline:  $\sqrt{3x-1}+(1+x)^2$

效果预览👇

This sentence uses $ delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$

2.4.2 将表达式编写为块

1$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$

效果预览👇

$$ \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) $$


III. 扩展语法

3.1 更改字体大小颜色

3.1.1 Markdown 语法

1<font face="黑体">我是黑体字</font>
2<font face="微软雅黑">我是微软雅黑</font>
3<font face="STCAIYUN">我是华文彩云</font>
4<font color=red>我是红色</font>
5<font color=#008000>我是绿色</font>
6<font color=Blue>我是蓝色</font>
7<font size=5>我是尺寸</font>
8<font face="黑体" color=green size=5>我是黑体,绿色,尺寸为5</font>

3.1.2 效果预览

我是黑体字 我是微软雅黑 我是华文彩云 我是红色 我是绿色 我是蓝色 我是尺寸 我是黑体,绿色,尺寸为5

3.2 表格宽度

3.2.1 Markdown 语法

1| 类别<div style="width:100px"> | 含义 | 行为 |
2|------------------------------|-----|-----|
3| 独奏环境 | 声音不是必不可少的,但它会使其他音频静音。例如,有配乐的游戏。 | 响应静音开关。 不与其他声音混合。 在后台不播放。  |
4| 周围 | 声音不是必不可少的,它不会使其他音频静音。例如,一个让人们在玩游戏时播放其他应用程序中的音乐来代替游戏原声的游戏。 | 响应静音开关。 与其他声音混合。 在后台不播放。 |
5| 回放 | 声音是必不可少的,并且可能与其他音频混合。例如,教外语的有声读物或教育应用,人们在离开应用后可能想听。| 不响应静音开关。 可能会或可能不会与其他声音混合。 可以在后台播放。 |
6| 记录 | 声音被记录下来。例如,提供音频录制模式的笔记应用程序。如果此类应用允许人们播放已记录的笔记,则可能会将其类别切换为播放。 | 不响应静音开关。 不与其他声音混合。 可以在后台录制。 |
7| 播放并录制 | 可能会同时录制和播放声音。例如,音频消息传递或视频通话应用程序。 | 不响应静音开关。 可能会或可能不会与其他声音混合。 可以在后台录制和播放。 |

3.2.2 效果预览

类别
含义行为
独奏环境声音不是必不可少的,但它会使其他音频静音。例如,有配乐的游戏。响应静音开关。 不与其他声音混合。 在后台不播放。
周围声音不是必不可少的,它不会使其他音频静音。例如,一个让人们在玩游戏时播放其他应用程序中的音乐来代替游戏原声的游戏。响应静音开关。 与其他声音混合。 在后台不播放。
回放声音是必不可少的,并且可能与其他音频混合。例如,教外语的有声读物或教育应用,人们在离开应用后可能想听。不响应静音开关。 可能会或可能不会与其他声音混合。 可以在后台播放。
记录声音被记录下来。例如,提供音频录制模式的笔记应用程序。如果此类应用允许人们播放已记录的笔记,则可能会将其类别切换为播放。不响应静音开关。 不与其他声音混合。 可以在后台录制。
播放并录制可能会同时录制和播放声音。例如,音频消息传递或视频通话应用程序。不响应静音开关。 可能会或可能不会与其他声音混合。 可以在后台录制和播放。

IV. 参考文档

  1. Markdown:Markdown 教程

  2. Github:在 GitHub 上写入


  1. My reference. ↩︎

  2. To add line breaks within a footnote, prefix new lines with 2 spaces. This is a second line. ↩︎