Markdown使用指南

标题

# 使用

Mackdown语法的标题可以用 #来写

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
#### Heading level 4<h4>Heading level 4</h4>#### Heading level 4
##### Heading level 5<h5>Heading level 5</h5>##### Heading level 5
###### Heading level 6<h6>Heading level 6</h6>###### Heading level 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

换行:

在 Mackdown 语法中,换行可以用两个 Enter 来代替

如:
zzy牛逼

666

zzy牛逼


666

加粗/斜体/划掉:

在 Mackdown 语法中, 加粗和斜体和划掉是非常简单的;

加粗

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

斜体:

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

划掉:

Markdown语法预览效果
at~~coder~~ atcoder

引用:

要创建块引用,请在段落前添加一个 > 符号。

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

带有其它元素的块引用

块引用可以包含其他 Markdown 格式的元素。并非所有元素都可以使用,你需要进行实验以查看哪些元素有效。

> #### 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.

列表:

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

有序列表

要创建有序列表,请在每个列表项前添加数字并紧跟一个英文句点。数字不必按数学顺序排列,但是列表应当以数字 1 起始。

Markdown语法HTML预览效果
1. First item2. Second item3. Third item4. Fourth item<ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>First itemSecond itemThird itemFourth item
1. First item1. Second item1. Third item1. Fourth item<ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>First itemSecond itemThird itemFourth item
1. First item8. Second item3. Third item5. Fourth item<ol><li>First item</li><li>Second item</li><li>Third item</li><li>Fourth item</li></ol>First itemSecond itemThird itemFourth item
1. First item2. Second item3. Third item 1. Indented item 2. Indented item4. Fourth item<ol><li>First item</li><li>Second item</li><li>Third item<ol><li>Indented item</li><li>Indented item</li></ol></li><li>Fourth item</li></ol>First itemSecond itemThird itemIndented itemIndented itemFourth 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 itemSecond itemThird itemFourth item
* 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 itemSecond itemThird itemFourth item
+ 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 itemSecond itemThird itemFourth item
- First item- Second item- Third item - Indented item - Indented item- Fourth item<ul><li>First item</li><li>Second item</li><li>Third item<ul><li>Indented item</li><li>Indented item</li></ul></li><li>Fourth item</li></ul>First itemSecond itemThird itemIndented itemIndented itemFourth item

代码语法:

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

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

转义反引号

如果你要表示为代码的单词或短语中包含一个或多个反引号,则可以通过将单词或短语包裹在双反引号( ```)中。

Markdown语法HTML预览效果
Use `code` in your Markdown file.<code>Use code in your Markdown file.</code>Use code in your Markdown file.

代码块

要创建代码块,请将代码块的每一行缩进至少四个空格或一个制表符。

    <html>
      <head>
      </head>
    </html>

渲染效果如下:

<html>
  <head>
  </head>
</html>

分隔线语法:

要创建分隔线,请在单独一行上使用三个或多个星号 (***)、破折号 (---) 或下划线 (___) ,并且不能包含其他内容。

***

---

_________________

以上三个分隔线的渲染效果看起来都一样:


链接语法

链接文本放在中括号内,链接地址放在后面的括号中,链接title可选。

超链接Markdown语法代码:[超链接显示名](超链接地址 "超链接title")

对应的HTML代码:<a href="超链接地址" title="超链接title">超链接显示名</a>

这是一个链接 [Markdown语法](https://markdown.com.cn)。

渲染效果如下:

这是一个链接 Markdown语法

给链接增加 Title

链接title是当鼠标悬停在链接上时会出现的文字,这个title是可选的,它放在圆括号中链接地址后面,跟链接地址之间以空格分隔。

这是一个链接 [Markdown语法](https://markdown.com.cn "最好的markdown教程")。

渲染效果如下:

这是一个链接 Markdown语法

网址和Email地址

使用尖括号可以很方便地把URL或者email地址变成可点击的链接。

<https://markdown.com.cn>
<fake@example.com>

渲染效果如下:

https://markdown.com.cn
fake@example.com

带格式化的链接

强调 链接, 在链接语法前后增加星号。 要将链接表示为代码,请在方括号中添加反引号。

I love supporting the **[EFF](https://eff.org)**.
This is the *[Markdown Guide](https://www.markdownguide.org)*.
See the section on [`code`](#code).

渲染效果如下:

I love supporting the EFF.
This is the Markdown Guide.
See the section on code.

引用类型链接

引用样式链接是一种特殊的链接,它使URL在Markdown中更易于显示和阅读。参考样式链接分为两部分:与文本保持内联的部分以及存储在文件中其他位置的部分,以使文本易于阅读。

链接的第一部分格式

引用类型的链接的第一部分使用两组括号进行格式设置。第一组方括号包围应显示为链接的文本。第二组括号显示了一个标签,该标签用于指向您存储在文档其他位置的链接。

尽管不是必需的,可以在第一组和第二组括号之间包含一个空格。第二组括号中的标签不区分大小写,可以包含字母,数字,空格或标点符号。

以下示例格式对于链接的第一部分效果相同:

  • [hobbit-hole][1]
  • [hobbit-hole] [1]

链接的第二部分格式

引用类型链接的第二部分使用以下属性设置格式:

  1. 放在括号中的标签,其后紧跟一个冒号和至少一个空格(例如[label]:)。
  2. 链接的URL,可以选择将其括在尖括号中。
  3. 链接的可选标题,可以将其括在双引号,单引号或括号中。

以下示例格式对于链接的第二部分效果相同:

  • [1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle
  • [1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle "Hobbit lifestyles"
  • [1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle 'Hobbit lifestyles'
  • [1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle (Hobbit lifestyles)
  • [1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> "Hobbit lifestyles"
  • [1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> 'Hobbit lifestyles'
  • [1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> (Hobbit lifestyles)

可以将链接的第二部分放在Markdown文档中的任何位置。有些人将它们放在出现的段落之后,有些人则将它们放在文档的末尾(例如尾注或脚注)。

图片语法:

要添加图像,请使用感叹号 (!), 然后在方括号增加替代文本,图片链接放在圆括号里,括号里的链接后可以增加一个可选的图片标题文本。

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

对应的HTML代码:<img src="图片链接" alt="图片alt" title="图片title">

![这是图片](/assets/img/philly-magic-garden.jpg "Magic Gardens")

渲染效果如下:

这是图片

链接图片

给图片增加链接,请将图像的Markdown 括在方括号中,然后将链接添加在圆括号中。

[![沙漠中的岩石图片](/assets/img/shiprock.jpg "Shiprock")](https://markdown.com.cn)

渲染效果如下:

沙漠中的岩石图片

转义字符语法

要显示原本用于格式化 Markdown 文档的字符,请在字符前面添加反斜杠字符 \ 。

\* Without the backslash, this would be a bullet in an unordered list.

渲染效果如下:

* Without the backslash, this would be a bullet in an unordered list.

可做转义的字符

以下列出的字符都可以通过使用反斜杠字符从而达到转义目的。

CharacterName
\backslash
`backtick (see also escaping backticks in code)
*asterisk
_underscore
{ }curly braces
[ ]brackets
( )parentheses
#pound sign
+plus sign
-minus sign (hyphen)
.dot
!exclamation mark
|pipe (see also escaping pipe in tables)

特殊字符自动转义

在 HTML 文件中,有两个字符需要特殊处理: <&< 符号用于起始标签,& 符号则用于标记 HTML 实体,如果你只是想要使用这些符号,你必须要使用实体的形式,像是 <&

& 符号其实很容易让写作网页文件的人感到困扰,如果你要打「AT&T」 ,你必须要写成「AT&T」 ,还得转换网址内的 & 符号,如果你要链接到:

http://images.google.com/images?num=30&q=larry+bird

你必须要把网址转成:

http://images.google.com/images?num=30&amp;q=larry+bird

才能放到链接标签的 href 属性里。不用说也知道这很容易忘记,这也可能是 HTML 标准检查所检查到的错误中,数量最多的。

Markdown 允许你直接使用这些符号,它帮你自动转义字符。如果你使用 & 符号的作为 HTML 实体的一部分,那么它不会被转换,而在其它情况下,它则会被转换成 &。所以你如果要在文件中插入一个著作权的符号,你可以这样写:

&copy;

Markdown 将不会对这段文字做修改,但是如果你这样写:

AT&T

Markdown 就会将它转为:

AT&amp;T

类似的状况也会发生在 < 符号上,因为 Markdown 支持 行内 HTML ,如果你使用 < 符号作为 HTML 标签的分隔符,那 Markdown 也不会对它做任何转换,但是如果你是写:

4 < 5

Markdown 将会把它转换为:

4 &lt; 5

需要特别注意的是,在 Markdown 的块级元素和内联元素中, <& 两个符号都会被自动转换成 HTML 实体,这项特性让你可以很容易地用 Markdown 写 HTML。(在 HTML 语法中,你要手动把所有的 <& 都转换为 HTML 实体。)

公式:

可以用LateX

在线LaTeX公式编辑器-编辑器

如:
H n = n ∑ i = 1 n 1 x i = n 1 x 1 + 1 x 2 + ⋯ + 1 x n G n = ∏ i = 1 n x i n = x 1 x 2 ⋯ x n n A n = 1 n ∑ i = 1 n x i = x 1 + x 2 + ⋯ + x n n Q n = ∑ i = 1 n x i 2 = x 1 2 + x 2 2 + ⋯ + x n 2 n H n ≤ G n ≤ A n ≤ Q n \begin{array}{c} H_{n}=\frac{n}{\sum \limits_{i=1}^{n}\frac{1}{x_{i}}}= \frac{n}{\frac{1}{x_{1}}+ \frac{1}{x_{2}}+ \cdots + \frac{1}{x_{n}}} \\ G_{n}=\sqrt[n]{\prod \limits_{i=1}^{n}x_{i}}= \sqrt[n]{x_{1}x_{2}\cdots x_{n}} \\ A_{n}=\frac{1}{n}\sum \limits_{i=1}^{n}x_{i}=\frac{x_{1}+ x_{2}+ \cdots + x_{n}}{n} \\ Q_{n}=\sqrt{\sum \limits_{i=1}^{n}x_{i}^{2}}= \sqrt{\frac{x_{1}^{2}+ x_{2}^{2}+ \cdots + x_{n}^{2}}{n}} \\ H_{n}\leq G_{n}\leq A_{n}\leq Q_{n} \end{array} Hn=i=1nxi1n=x11+x21++xn1nGn=ni=1nxi =nx1x2xn An=n1i=1nxi=nx1+x2++xnQn=i=1nxi2 =nx12+x22++xn2 HnGnAnQn
或:

$\cos \alpha - \cos \beta =-2\sin \frac{\alpha + \beta}{2}\sin \frac{\alpha - \beta}{2} $

$$
 \begin{array}{c}   H_{n}=\frac{n}{\sum \limits_{i=1}^{n}\frac{1}{x_{i}}}= \frac{n}{\frac{1}{x_{1}}+ \frac{1}{x_{2}}+ \cdots + \frac{1}{x_{n}}} \\ G_{n}=\sqrt[n]{\prod \limits_{i=1}^{n}x_{i}}= \sqrt[n]{x_{1}x_{2}\cdots x_{n}} \\ A_{n}=\frac{1}{n}\sum \limits_{i=1}^{n}x_{i}=\frac{x_{1}+ x_{2}+ \cdots + x_{n}}{n} \\ Q_{n}=\sqrt{\sum \limits_{i=1}^{n}x_{i}^{2}}= \sqrt{\frac{x_{1}^{2}+ x_{2}^{2}+ \cdots + x_{n}^{2}}{n}} \\ H_{n}\leq G_{n}\leq A_{n}\leq Q_{n} \end{array}
$$
$\cos \alpha - \cos \beta =-2\sin \frac{\alpha + \beta}{2}\sin \frac{\alpha - \beta}{2} $

推荐编辑器

在线Markdown编辑器

markdown编辑器 - 在线工具 (tool.lu)

好用!

离线Markdown

typora-setup-x64.exe - 蓝奏云 (lanzoup.com)

  • 21
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值