Markdown 支持 有序列表 和 无序列表。
无序列表
使用 星号 *
、加号 +
或是减号 -
作为列表标记。标记符号后面一定要接着至少一个空格或制表符(Tab)。
* Green (比较推荐)
- Red (比较好用)
+ Blue
- Green (比较推荐)
- Red (比较好用)
- Blue
无序列表标记符前每增加 2 个空格或是 4 个空格,增加一个层级:
- 伟大始于渺小。
- 说和做是迥然不同的两回事。
- 行动比语言更响亮。
- 伟大始于渺小。
- 说和做是迥然不同的两回事。
- 行动比语言更响亮。
- 说和做是迥然不同的两回事。
有序列表
则使用数字接着一个英文句点。标记符号后面也要接着至少一个空格或制表符(Tab)。
1. First paragraph
2. Second paragraph
3. Third paragraph
- First paragraph
- Second paragraph
- Third paragraph
在列表标记上使用的数字并不会影响输出的 HTML 结果,这意味着,你可以 Use lazy numbering for long lists:
1. Foo.
1. Bar.
1. Foofoo.
1. Barbar.
1. Baz.
- Foo.
- Bar.
- Foofoo.
- Barbar.
- Baz.
有序列表标记符前每增加一个 Tab,增加一个层级:
1. 他是猪吗?
1.1 是的,他情商太低
1.2 不是,他智商很高
2. 我是狗吗?
2.1 是的,每天忙的累死累活(有序列表标记符号前有一个 Tab)
2.2 不是,要求高累点我乐意
2.2.1 不要想太多(有序列表标记符号前有两个 Tab)
2.2.2 成功有方法
- 他是猪吗?
1.1 是的,他情商太低
1.2 不是,他智商很高 - 我是狗吗?
2.1 是的,每天忙的累死累活(有序列表标记符号前有一个 Tab)
2.2 不是,要求高累点我乐意
2.2.1 不要想太多(有序列表标记符号前有两个 Tab)
2.2.2 成功有方法
列表项目中的段落
列表项目可以包含多个段落,每个项目下的段落,都必须缩进 4 个空格或是 1 个制表符(Tab)。
无序列表:
- Every man is his own worst enemy. Wisdom in the mind is better than money in the hand. Every man is his own worst enemy. Wisdom in the mind is better than money in the hand.
From small beginnings comes great things.(列表项目中的段落)
- Saying and doing are two different things. Actions speak louder than words. Saying and doing are two different things. Actions speak louder than words.
-
Every man is his own worst enemy. Wisdom in the mind is better than money in the hand. Every man is his own worst enemy. Wisdom in the mind is better than money in the hand.
From small beginnings comes great things. (列表项目中的段落)
Saying and doing are two different things. Actions speak louder than words. Saying and doing are two different things. Actions speak louder than words.
有序列表:
1. Every man is his own worst enemy. Wisdom in the mind is better than money in the hand. Every man is his own worst enemy. Wisdom in the mind is better than money in the hand.
From small beginnings comes great things. (列表项目中的段落)
2. Saying and doing are two different things. Actions speak louder than words. Saying and doing are two different things. Actions speak louder than words.
-
Every man is his own worst enemy. Wisdom in the mind is better than money in the hand. Every man is his own worst enemy. Wisdom in the mind is better than money in the hand.
From small beginnings comes great things. (列表项目中的段落)
Saying and doing are two different things. Actions speak louder than words. Saying and doing are two different things. Actions speak louder than words.
列表项目内引用
在引用标记符 >
前需要缩进,一般 2 个空格键:
- A list item with a blockquote:
> This is a blockquote(标记符 > 前有 2 个空格)
> inside a list item.
1. A list item with a blockquote:
> This is a blockquote(标记符 > 前有 4 个空格或者 1 个 Tab)
> inside a list item.
- A list item with a blockquote:
This is a blockquote
inside a list item.
- A list item with a blockquote:
This is a blockquote
inside a list item.
列表项目内代码块
如果要放代码区块的话,中间空一行,然后缩进两次,也就是 8 个空格或是 2 个制表符(Tab):
- 一列表项包含一个代码块:
我是代码区块,我上方有一空行,前方有8个空格。
1. 一列表项包含一个代码块:
我是代码区块,我上方有一空行,前方有8个空格。
-
一列表项包含一个代码块:
我是代码区块,我上方有一空行,前方有8个空格。
-
一列表项包含一个代码块:
我是代码区块,我上方有一空行,前方有8个空格。
有序列表异常
当然,项目列表很可能会不小心产生,像是下面这样的写法:
- What a great season.
1986 头怎么伸出去了?要避免这样的状况,你可以在句点前面加上反斜杠。
1986\. What a great season.
1986. What a great season.
访问简书专题:【集锦】Markdown 语法快速上手,10 分钟带你学会 Markdown。也可以访问 我的笔记,查看更多内容。
光懂语法还不能写出排版优秀的文章,我们还需要学习 Markdown 编写规范,让我们的文章看起来很专业。已经有好人写了文章:
少数派 的文章排版比较规范,大家可以多逛逛。
学会了排版,要写出一篇优秀的文章,我们还要在内容管理上下功夫,最基本的素养就是不要传递错误的信息,其次是关注所传递内容的价值大小。这时候,我们不仅要有相关专业知识(有理有据),还要想文章的框架结构,要考虑读者的感受等。平时看热门文章和畅销图书时,多留意它们的排版和文章结构,都可以学习借用。这里只是抛砖引玉,详细技巧可以知乎一下。