自建站53个日夜以来,自己写文章基本上都是用Markdown,但格式还是稍有欠缺。作为初学者,这里就用来记一下Markdown所有语法了,站长会慢慢更新的。此文章要用Chrom浏览器下观看
标签语法
1 | # Heading level 1 |
预览效果:
Heading level 1
Heading level 2
Heading level 3
Heading level 4
Heading level 5
Heading level 6
Markdown段落
1 | I really like using Markdown. |
预览效果:
I really like using Markdown.
I think I’ll use it to format all of my documents from now on.
Markdown换行语法
第一种方法
在一行的末尾添加两个或多个空格,然后按回车键,即可创建一个换行
1 | This is the first line. |
预览效果:
This is the first line.
And this is the second line.
第二种方法
1 | This is the first line.<br> |
预览效果:
This is the first line.
And this is the second line.
随自己喜好,两种方法。
Markdown强调语法
通过将文本设置为粗体或斜体来强调其重要性。
粗体(Blod)
要加粗文本,请在单词或短语的前后各添加两个星号(**)或两个下划线(__)。
1 | I just love **bold text**. |
预览效果:
I just love bold text.
I just love bold text.
Loveisbold
粗体(Blod)-注意
在单词或短语中间部分加粗的话,请使用星号
Loveisbold ✅
Love__is__bold ❌
斜体(Italic)
用斜体显示文本,请在单词或短语前后添加一个星号(*)或一个下划线(_)。
1 | Italicized text is the *cat's meow*. |
预览效果:
Italicized text is the cat’s meow.
Italicized text is the cat’s meow.
Acatmeow
Markdown语法引用
这个就是把一句话给重点突出。
1 | > Dorothy followed her through many of the beautiful rooms in her castle. |
预览效果:
Dorothy followed her through many of the beautiful rooms in her castle.
多个段落的块引用
顾名思义就是多个段落重点突出。
1 | > Dorothy followed her through many of the beautiful rooms in her castle. |
效果预览:
Dorothy followed her through many of the beautiful rooms in her castle.
The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
嵌套引用
1 | > Dorothy followed her through many of the beautiful rooms in her castle. |
效果预览:
Dorothy followed her through many of the beautiful rooms in her castle.
The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
带有其他元素的引用
1 | > # # # # The quarterly results look great! |
效果预览:
The quarterly results look great!
- Revenue was off the chart.
- Profits were higher than ever.
Everything is going according to plan.
Markdown 列表语法
可以将多个条目组织成有序或无序列表。
有序列表
看他官方文档很谜语人,咱们这里直接上代码和示例。
1 | 1. First item |
效果预览:
- First item
- Second item
- Third item
- Fourth item
就算都是1,也会自动排号:
1 | 1. First item |
效果预览:
- First item
- Second item
- Third item
- Fourth item
顺序乱的,也会排列好。
1 | 1. First item |
效果预览:
- First item
- Second item
- Third item
- Fourth item
当然也支持子列表(嵌套列表),代码如下:
1 | 1. First item |
效果预览:
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
无序列表
若要用无序列表,就直接每个列表项前加星号(*),加号(+),破折号(-).
带破折号的无序列表
1 | - First item |
效果预览:
- First item
- Second item
- Third item
- Fourth item
带星号的无序列表
1 | * First item |
效果预览:
- First item
- Second item
- Third item
- Fourth item
带加号的无序列表
1 | + First item |
效果预览:
- First item
- Second item
- Third item
- Fourth item
创建嵌套列表,代码如下
1 | - First item |
效果预览:
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
在列表中嵌套其他元素
未完待续