# Markdown 快速参考

*标题、链接、图片、代码块、表格*

> Source: CommonMark Spec (commonmark.org) · MIT

## 标题

```
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
```

## 强调

### 粗体与斜体

| Command | Description |
|---------|-------------|
| `*italic* or _italic_` | 斜体 |
| `**bold** or __bold__` | 粗体 |
| `***bold italic***` | 粗斜体 |
| `~~strikethrough~~` | 删除线（GFM） |

## 列表

### 无序列表

```
- Item one
- Item two
  - Nested item
  - Another nested
- Item three
```

### 有序列表

```
1. First item
2. Second item
   1. Nested ordered
   2. Another nested
3. Third item
```

## 链接与图片

| Command | Description |
|---------|-------------|
| `[text](url)` | 行内链接 |
| `[text](url "title")` | 带悬停标题的链接 |
| `[ref][id] / [id]: url` | 引用式链接 |
| `<https://example.com>` | 自动链接 |
| `![alt](image.png)` | 图片 |
| `![alt](img "title")` | 带标题的图片 |
| `[![alt](img)](url)` | 带链接的图片 |

## 代码

### 行内与围栏代码块

```
Use `inline code` in a sentence.

```python
def greet(name):
    return f"Hello, {name}!"
```

```javascript
const greet = (name) => `Hello, ${name}!`;
```
```

*在 ``` 后指定语言以启用语法高亮*

### 缩进代码块

```
Indent 4 spaces
for a code block
(no syntax highlighting)
```

## 引用块

```
> This is a blockquote.
>
> It can span multiple paragraphs.

> Nested blockquotes:
>> Second level
>>> Third level
```

## 表格（GFM）

```
| Left   | Center  | Right  |
|--------|:-------:|-------:|
| cell 1 | cell 2  | cell 3 |
| cell 4 | cell 5  | cell 6 |
```

*`:` 控制对齐——左对齐（默认）、居中、右对齐*

## 任务列表（GFM）

```
- [x] Completed task
- [ ] Incomplete task
- [ ] Another to-do
```

## 水平线

```
---
***
___
```

*三个或更多连字符、星号或下划线*

## 转义

### 反斜杠转义

```
\*not italic\*
\# not a heading
\[not a link\]
```

### 可转义字符

| Command | Description |
|---------|-------------|
| `\  `  *  _` | 反斜杠、反引号、星号、下划线 |
| `{}  []  ()` | 大括号、中括号、小括号 |
| `#  +  -  .` | 井号、加号、连字符、句点 |
| `!  \|` | 感叹号、管道符 |
