自建站53个日夜以来,自己写文章基本上都是用Markdown,但格式还是稍有欠缺。作为初学者,这里就用来记一下Markdown所有语法了,站长会慢慢更新的。此文章要用Chrom浏览器下观看

标签语法

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

预览效果:

Heading level 1

Heading level 2

Heading level 3

Heading level 4

Heading level 5
Heading level 6

Markdown段落

1
2
3
I really like using Markdown.

I think I'll use it to format all of my documents from now on.

预览效果:

I really like using Markdown.

I think I’ll use it to format all of my documents from now on.

Markdown换行语法

第一种方法

在一行的末尾添加两个或多个空格,然后按回车键,即可创建一个换行

1
2
This is the first line.  
And this is the second line.

预览效果:

This is the first line.
And this is the second line.

第二种方法

1
2
This is the first line.<br>
And this is the second line.

预览效果:

This is the first line.

And this is the second line.

随自己喜好,两种方法。

Markdown强调语法

通过将文本设置为粗体或斜体来强调其重要性。

粗体(Blod)

要加粗文本,请在单词或短语的前后各添加两个星号(**)或两个下划线(__)。

1
2
3
I just love **bold text**.
I just love __bold text__.
Love**is**bold

预览效果:

I just love bold text.
I just love bold text.
Loveisbold

粗体(Blod)-注意

在单词或短语中间部分加粗的话,请使用星号
Loveisbold ✅
Love__is__bold ❌

斜体(Italic)

用斜体显示文本,请在单词或短语前后添加一个星号(*)或一个下划线(_)。

1
2
3
Italicized text is the *cat's meow*.
Italicized text is the _cat's meow_.
A*cat*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
2
3
> 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.

效果预览:

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
2
3
> 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.

效果预览:

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
2
3
4
5
6
> # # # # The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
> *Everything* is going according to **plan**.

效果预览:

The quarterly results look great!

  • Revenue was off the chart.
  • Profits were higher than ever.

Everything is going according to plan.

Markdown 列表语法

可以将多个条目组织成有序或无序列表。

有序列表

看他官方文档很谜语人,咱们这里直接上代码和示例。

1
2
3
4
1. First item 
2. Second item
3. Third item
4. Fourth item

效果预览:

  1. First item
  2. Second item
  3. Third item
  4. Fourth item

就算都是1,也会自动排号:

1
2
3
4
1. First item
1. Second item
1. Third item
1. Fourth item

效果预览:

  1. First item
  2. Second item
  3. Third item
  4. Fourth item

顺序乱的,也会排列好。

1
2
3
4
1. First item
8. Second item
3. Third item
5. Fourth item

效果预览:

  1. First item
  2. Second item
  3. Third item
  4. Fourth item

当然也支持子列表(嵌套列表),代码如下:

1
2
3
4
5
6
1. First item
2. Second item
3. Third item
1. Indented item
2. Indented item
4. Fourth item

效果预览:

  1. First item
  2. Second item
  3. Third item
    1. Indented item
    2. Indented item
  4. Fourth item

无序列表

若要用无序列表,就直接每个列表项前加星号(*),加号(+),破折号(-).

带破折号的无序列表

1
2
3
4
- First item
- Second item
- Third item
- Fourth item

效果预览:

  • First item
  • Second item
  • Third item
  • Fourth item

带星号的无序列表

1
2
3
4
* First item
* Second item
* Third item
* Fourth item

效果预览:

  • First item
  • Second item
  • Third item
  • Fourth item

带加号的无序列表

1
2
3
4
+ First item
+ Second item
+ Third item
+ Fourth item

效果预览:

  • First item
  • Second item
  • Third item
  • Fourth item

创建嵌套列表,代码如下

1
2
3
4
5
6
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item

效果预览:

  • First item
  • Second item
  • Third item
    • Indented item
    • Indented item
  • Fourth item

在列表中嵌套其他元素

未完待续