markdown 学习

114 阅读3分钟

优雅地沉浸式记录,专注内容而不是纠结排版

Markdown 标题语法

创建标题在语句前加 #, 总共有6级。

Markdown语法HTML预览效果
# Heading level 1<h1>Heading level 1</h1># Heading level 1
## Heading level 2<h2>Heading level 2</h2>## Heading level 2
### Heading level 3<h3>Heading level 3</h3>### Heading level 3

Markdown 段落

创建段落,多行。

Markdown语法HTML预览效果
I really like using Markdown. I think I'll use it to format all of my documents from now on.<p>I really like using Markdown.</p> <p>I think I'll use it to format all of my documents from now on.</p>I really like using Markdown.I think I'll use it to format all of my documents from now on.

换行语法:

按回车键,即可创建一个换行(<br>)

粗体(Bold)

要加粗文本,请在单词或短语的前后各添加两个星号(asterisks)或下划线(underscores)。如需加粗一个单词或短语的中间部分用以表示强调的话,请在要加粗部分的两侧各添加两个星号(asterisks)。

Markdown语法HTML预览效果
I just love **bold text**.I just love <strong>bold text</strong>.I just love bold text.
I just love __bold text__.I just love <strong>bold text</strong>.I just love bold text.
Love**is**boldLove<strong>is</strong>boldLoveisbold

斜体

前面加一个*, 或者加_,或者是html语法。

Markdown语法HTML预览效果
Italicized text is the *cat's meow*.Italicized text is the <em>cat's meow</em>.Italicized text is the cat’s meow.
Italicized text is the _cat's meow_.Italicized text is the <em>cat's meow</em>.Italicized text is the cat’s meow.
A*cat*meowA<em>cat</em>meowAcatmeow
要创建块引用,请在段落前添加一个 > 符号。
> Dorothy followed her through many of the beautiful rooms in her castle.

渲染效果如下所示:

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.

渲染效果如下:

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.

渲染效果如下:

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.

有序列表

✅  Do this
1. First item

无序列表

每个列表项前面添加破折号 (-)、星号 (*) 或加号 (+) 。缩进一个或多个列表项可创建嵌套列表。

Markdown语法HTML预览效果
- First item - Second item - Third item - Fourth item<ul> <li>First item</li> <li>Second item</li> <li>Third item</li> <li>Fourth item</li> </ul>- First item
  • Second item
  • Third item
  • Fourth item

Markdown 代码语法

要将单词或短语表示为代码,请将其包裹在反引号 (`) 中。

Markdown语法HTML预览效果
At the command prompt, type `nano`.At the command prompt, type <code>nano</code>.At the command prompt, type nano.
`
code
`

Markdown 链接语法

这是一个链接 baidu

[link](https://www.example.com/my%20great%20page)

Markdown 图片语法

插入图片Markdown语法代码:![图片alt](图片链接 "图片title")