Markdown语法

以下介绍几种常用常见的Markdown语法

1. 强调

在Markdown中,可以使用 和 _ 来表示斜体和加粗。例如粗体*

1
2
**粗体**
__斜体__

效果:

粗体

斜体

2. 锚点

1
# 锚点

会被解析成

1
<h1 id="user-content-锚点">锚点</h1>

这样我们添加了一个user-content-的前缀,如果是自己添加链接使用Markdown的形式,可以通过链接的形式访问

1
[访问链接](#user-content-锚点)

3. 代办列表

表示列表是否勾选状态,注意: [ ]前后都要有空格

1
2
- [ ] 不勾选
- [ x ] 勾选

效果如下:

  • 不勾选
  • 勾选

4. 表格

1
| Content Cell | Content Cell  | Content Cell |

效果

Content Cell Content Cell Content Cell

5. 图片

1
2
![Alt text](/path/to/img.png) // local picture
![Alt text](img url) // remote picture

Markdown中不能直接改变图片大小,但是我们可以直接用HTML写

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 调整图片大小
<img src="./screenshots/one.png" width="200px"/>
// 单张图片居中显示
<center>
<img src="./screenshots/one.png">
</center>
// 两张图片并排显示
<figure class="half">
<img src="./screenshots/one.png">
<img src="./screenshots/one.png">
</figure>
// 三张图片并排显示
<figure class="third">
<img src="./screenshots/one.png">
<img src="./screenshots/one.png">
<img src="./screenshots/one.png">
</figure>
// 如果想要宽度固定并排两张照片并居中
<center class="half">
<img src="http://xxx.jpg" width="300"/>
<img src="http://yyy.jpg" width="300"/> // width="30%" 也可以用百分比标记宽度
</center>

参考链接: