语法 #
标题 #
# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题
一级标题 #
二级标题 #
三级标题 #
四级标题 #
五级标题 #
六级标题 #
文本样式 #
_斜体_
**粗体**
~~删除线~~
++增加线++
~下标~
^上标^
H~2~O
x^2^
==标记==
斜体
粗体
删除线
增加线
下标
上标
H2O
x2
标记
引用文本 #
> 引用文本
> 引用文本 2
>
> > 引用文本
> > 引用文本 2
引用文本
引用文本 2引用文本
引用文本 2
引用代码 #
这是 `行内代码`
这是 行内代码
这是代码块
```js
const i = 0;
```
这是代码块
const i = 0;
链接 #
[link text](https://example.com)
https://example.com
章节链接 #
你可以直接链接到渲染文件中的某个部分,方法是将鼠标悬停在该部分标题上以显示 #
[语法](#语法)
相对链接 #
[第二个页面](./2.第二个页面.second.md)
以 ./ 开头的链接将相对于存储库根目录。 可使用所有相对链接操作数,例如 ./ 和 …/。
图像 #

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/25423296/163456776-7f95b81a-f1ed-45f7-b7ab-8fa810d529fa.png">
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/25423296/163456779-a8556205-d0a5-45e2-ac17-42d089e3c3f8.png">
<img alt="Shows an illustrated sun in light mode and a moon with stars in dark mode." src="https://user-images.githubusercontent.com/25423296/163456779-a8556205-d0a5-45e2-ac17-42d089e3c3f8.png">
</picture>
你可以尝试切换系统深浅色

列表 #
- George Washington
* John Adams
- Thomas Jefferson
- George Washington
- John Adams
- Thomas Jefferson
1. James Madison
2. James Monroe
3. John Quincy Adams
- James Madison
- James Monroe
- John Quincy Adams
嵌套列表 #
1. First list item
- First nested list item
- Second nested list item
- First list item
- First nested list item
- Second nested list item
- First nested list item
缩进列表 #
目录 1
: 缩进一
: 缩进二
- 目录 1
- 缩进一
- 缩进二
任务列表 #
- [x] #739
- [ ] https://github.com/octo-org/octo-repo/issues/740
- [ ] Add delight to the experience when all tasks are complete :tada:
使用表情符号 #
:+1:
👍
段落 #
通过在文本行之间留一个空白行,可创建新段落。
强制换行 #
一行文本的最后加两个空格,可强制换行。
分隔符 #
---
脚注 #
您可以使用此括号语法为您的内容添加脚注:
Here is a simple footnote[^1].
A footnote can also have multiple lines[^2].
[^1]: My reference.
[^2]:
To add line breaks within a footnote, prefix new lines with 2 spaces.
This is a second line.
Here is a simple footnote[1].
A footnote can also have multiple lines[2].
警报 #
警报是基于块引用语法的 Markdown 扩展,可用于强调关键信息。 在 GitHub 上,它们以独特的颜色和图标显示,以指示内容的显著性。
只有在对用户成功至关重要时才使用警报,并将每篇文章的警报限制在一到两个,以防止读者负担过重。 此外,应避免连续发出警报。 警报无法嵌套在其他元素中。
要添加警报,请使用指定警报类型的特殊块引用行,然后在标准块引用中添加警报信息。 可以使用以下五种类型的警报:
> [!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.
> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
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.
Caution
Advises about risks or negative outcomes of certain actions.
隐藏有评论的内容 #
您可以通过在 HTML 评论中加入内容来指示 GitHub 隐藏渲染的 Markdown 中的内容。
<!-- This content will not appear in the rendered Markdown -->
忽略 Markdown 格式 #
通过在 Markdown 字符前面输入 \,可指示 GitHub 忽略 Markdown 格式(或对其进行转义)。
Let's rename \*our-new-project\* to \*our-old-project\*.
Let’s rename *our-new-project* to *our-old-project*.
创建表 #
| First Header | Second Header |
| ------------ | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
First Header | Second Header |
---|---|
Content Cell | Content Cell |
Content Cell | Content Cell |
单元格的宽度可以不同,无需在列内准确对齐。 标题行的第一列中必须至少有三个横线。
| Command | Description |
| ---------- | ---------------------------------------------- |
| git status | List all new or modified files |
| git diff | Show file differences that haven't been staged |
格式化表格中的内容 #
| Command | Description |
| ------------ | -------------------------------------------------- |
| `git status` | List all _new or modified_ files |
| `git diff` | Show file differences that **haven't been** staged |
Command | Description |
---|---|
git status | List all new or modified files |
git diff | Show file differences that haven’t been staged |
可以通过在标题行中连字符的左侧、右侧或两侧添加冒号 :,来靠左、靠右或居中对齐列中的文本。
| Left-aligned | Center-aligned | Right-aligned |
| :----------- | :------------: | ------------: |
| git status | git status | git status |
| git diff | git diff | git diff |
Left-aligned | Center-aligned | Right-aligned |
---|---|---|
git status | git status | git status |
git diff | git diff | git diff |
若要包含竖线 | 作为单元格中的内容,请在竖线前使用 \:
| Name | Character |
| -------- | --------- |
| Backtick | ` |
| Pipe | \| |
Name | Character |
---|---|
Backtick | ` |
Pipe | | |
创建折叠部分 #
<details>
<summary>Tips for collapsed sections</summary>
### You can add a header
You can add text within a collapsed section.
You can add an image or a code block, too.
```ruby
puts "Hello World"
```
</details>
Tips for collapsed sections
You can add a header #
You can add text within a collapsed section.
You can add an image or a code block, too.
puts "Hello World"
创建关系图 #
```mermaid
flowchart TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
```
flowchart TD A[Christmas] -->|Get money| B(Go shopping) B --> C{Let me think} C -->|One| D[Laptop] C -->|Two| E[iPhone] C -->|Three| F[fa:fa-car Car]
flowchart TD A[Christmas] -->|Get money| B(Go shopping) B --> C{Let me think} C -->|One| D[Laptop] C -->|Two| E[iPhone] C -->|Three| F[fa:fa-car Car]
数学公式 #
发扽 $x^=1$
$x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1x^=1$
发扽
属性 #
输入:
# 标题 {.类名 #哈哈}
段落 {data-toggle=modal}
段落 _红色_{.red} 文本
输出:
<h1 class="类名" id="哈哈">标题</h1>
<p data-toggle="modal">段落</p>
<p>段落 <em class="red">红色</em> 文本</p>
代码块:
```python {data=asdf}
nums = [x for x in range(10)]
```
输出:
<pre><code data="asdf" class="language-python">
nums = [x for x in range(10)]
</code></pre>
你可以用 ..
当作 css-module=
的简写:
Use the css-module green on this paragraph. {..green}
输出:
<p css-module="green">Use the css-module green on this paragraph.</p>
带有[样式]{.red}的段落
输出:
<p>带有<span class="red">样式</span>的段落</p>