标题
创建标题前加#符号来决定标题的大小
# A first-level heading
## A second-level heading
### A third-level heading
文本样式
可以在评论字段和 .md
文件中以粗体、斜体、删除线、下标或上标文本表示强调。
Style | 语法 | 键盘快捷键 | 示例 | 输出 |
---|---|---|---|---|
加粗 | ** ** 或 __ __ | Command+B (Mac) 或 Ctrl+B (Windows/Linux) | **This is bold text** | 这是粗体文本 |
斜体 | * * 或 _ _ | Command+I (Mac) 或 Ctrl+I (Windows/Linux) | _This text is italicized_ | 这是斜体文本 |
删除线 | ~~ ~~ | 无 | ~~This was mistaken text~~ | 这是错误文本 |
粗体和嵌入的斜体 | ** ** 和 _ _ | 无 | **This text is _extremely_ important** | 此文本_非常_重要 |
全部粗体和斜体 | *** *** | 无 | ***All this text is important*** | 所有这些文本都很重要 |
下标 | <sub> </sub> | 无 | This is a <sub>subscript</sub> text | 这是下标文本 |
上标 | <sup> </sup> | 无 | This is a <sup>superscript</sup> text | 这是上标文本 |
引用文本
使用>来引用文本
Text that is not a quote
> Text that is a quote
引用代码
使用单反引号可以批注句子中的代码或命令,反引号中的文本不会被格式化,你也可以按 Command+E (Mac) 或 Ctrl+E (Windows/Linux) 键盘快捷方式将代码块的反引号插入到 Markdown 一行中。
Use `git status` to list all new or modified files that haven't yet been committed.
多行格式化时使用三反引号
Some basic Git commands are:
```
git status
git add
git commit
```
支持颜色模块
可以使用反引号在句子中标注颜色。 反引号内支持的颜色模型将显示颜色的可视化效果。
The background color is `#ffffff` for light mode and `#000000` for dark mode.
下面是支持的颜色模块
Color | 语法 | 示例 | 输出 |
---|---|---|---|
HEX | `#RRGGBB` | `#0969DA` | |
RGB | `rgb(R,G,B)` | `rgb(9, 105, 218)` | |
HSL | `hsl(H,S,L)` | `hsl(212, 92%, 45%)` |
链接
通过将链接文本用方括号 [ ]
括起来,然后将 URL 用括号 ( )
括起来,可创建内联链接。还可以通过突出显示文本使用快捷方式command+v创建Markdown超链接,要将文本替换成链接请使用键盘快捷方式 Command+Shift+V。
This site was built using [GitHub Pages](https://pages.github.com/).
图像
通过添加 ! 并 将 alt 文本用 [ ]
括起来,可显示图像。 替换文字是等效于图像中信息的短文本。 然后将图像的链接用括号 ()
括起来。
![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)
下面是一些使用相对链接显示图像的示例。
上下文 | 相对链接 |
---|---|
在同一分支的 .md 文件中 | /assets/images/electrocat.png |
在另一个分支的 .md 文件中 | /../main/assets/images/electrocat.png |
在仓库的议题、拉取请求和评论中 | ../blob/main/assets/images/electrocat.png?raw=true |
在另一个存储库的 .md 文件中 | /../../../../github/docs/blob/main/assets/images/electrocat.png |
在另一个仓库的议题、拉取请求和评论中 | ../../../github/docs/blob/main/assets/images/electrocat.png?raw=true |
列表
可通过在一行或多行文本前面加上 -、* 或 + 来创建一个无序列表。
- George Washington
* John Adams
+ Thomas Jefferson
对列表排序可直接在列表前添加数字
1. James Madison
2. James Monroe
3. John Quincy Adams