不规范使用的 h1 这里就不写了,样式与标题基本相同

注:在文本中使用 h1 是不规范的,因此在目录中 h1 将不被渲染计入

标题语法 level 2

Heading level 3

Heading level 4

Heading level 5
Heading level 6

注:一般不适用 h5 h6(比文本还小的标题真的不行)

段落语法

I really like using Markdown.


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

换行语法

This is the first line. It will use two spaces to wrap.
And this is the second line.

This is the first line. It will use <br> to wrap.

And this is the second line.

强调语法

粗体(Bold)

I just love bold text. It use ** to bold text.

I just love bold text. It use __ to bold text.

斜体(Italic)

Italicized text is the cat’s meow. It use * to italic text.

Italicized text is the cat’s meow. It use _ to italic text.

粗体(Bold)和斜体(Italic)

This text is really important. It use *** to bold and italic text.

This text is really important. It use ___ to bold and italic text.

This text is really important. It use __* *__ to bold and italic text.

This text is really important. It use **_ _** to bold and italic text.

This text is really important. It use *__ __* to bold and italic text.

This text is really important. It use **_ _** to bold and italic text.

引用语法

单行引用

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

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.

带有其它元素的块引用

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

The quarterly results look great!

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

Everything is going according to plan.

列表语法

有序列表

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

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

嵌套有序列表:

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

无序列表

要创建无序列表,请在每个列表项前面添加破折号 (-)、星号 (*) 或加号 (+) 。

  • First item (it use -)
  • Second item
  • Third item
  • Fourth item
  • First item (it use *)
  • Second item
  • Third item
  • Fourth item
  • First item (it use +)
  • Second item
  • Third item
  • Fourth item

嵌套无序列表:

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

在列表中嵌套其他元素

要在保留列表连续性的同时在列表中添加另一种元素,请将该元素缩进四个空格或一个制表符。

段落

  • This is the first list item.

  • Here’s the second list item.

    I need to add another paragraph below the second list item.

  • And here’s the third list item.

引用块

  • This is the first list item.

  • Here’s the second list item.

    A blockquote would look great below the second list item.

  • And here’s the third list item.

代码块

代码块通常采用四个空格或一个制表符缩进。当它们被放在列表中时,请将它们缩进八个空格或两个制表符。

  1. Open the file.

  2. Find the following code block on line 21:

    <html>
      <head>
        <title>Test</title>
      </head>
    
  3. Update the title to match the name of your website.

图片

  1. Open the file containing the Linux mascot.

  2. Marvel at its beauty.

    Tux, the Linux mascot

  3. Close the file.

代码语法

行内代码

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

At the command prompt, type nano.

转义反引号

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

Use `code` in your Markdown file.

代码块

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

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

围栏代码块

在代码块之前和之后的行上使用三个反引号(```)或三个波浪号(~~~)。

Code
1
2
3
4
5
{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
Plaintext

语法高亮

许多Markdown处理器都支持受围栏代码块的语法突出显示。使用此功能,您可以为编写代码的任何语言添加颜色突出显示。要添加语法突出显示,请在受防护的代码块之前的反引号旁边指定一种语言。

Code
1
2
3
4
5
{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
JSON

hexo 带标题的语法块

标题
1
2
3
4
5
{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
JSON
./test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<title>Title</title>

<style>body {width: 500px;}</style>

<script type="application/javascript">
function $init() {return true;}
</script>

<body>
<p checked class="title" id='title'>Title</p>
<!-- here goes the rest of the page -->
</body>
HTML, XML
./test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>

int main(int argc, char *argv[]) {

/* An annoying "Hello World" example */
for (auto i = 0; i < 0xFFFF; i++)
cout << "Hello, World!" << endl;

char c = '\n';
unordered_map <string, vector<string> > m;
m["key"] = "\\\\"; // this is an error

return -2e3 + 12l;
}
C++

分隔线语法

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

*** 分隔线


--- 分隔线


___ 分隔线


链接语法

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

这是一个链接 Markdown语法

鼠标悬浮出现文字 Markdown语法

网址和Email地址

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

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

带格式化的链接

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

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

引用类型链接

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

  1. 链接的第一部分格式

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

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

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

    hobbit-hole

  2. 链接的第二部分格式

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

    放在括号中的标签,其后紧跟一个冒号和至少一个空格(例如[label]:)。

    链接的URL,可以选择将其括在尖括号中。

    链接的可选标题,可以将其括在双引号,单引号或括号中。

    • [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)

注:不过这个语法没有脚注好用

图片语法

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

![Tux, the Linux mascot](./img/favicon.png)

灯箱与样式测试

这一行内插入个大图片行内大图片测试试试

这一行内插入个小图片行内小图片测试试试

图片链接

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

Tux, the Linux mascot

转义字符语法

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

此部分建议查看文档:Markdown 转义字符语法

内嵌 HTML 标签

对于 Markdown 涵盖范围之外的标签,都可以直接在文件里面用 HTML 本身。如需使用 HTML,不需要额外标注这是 HTML 或是 Markdown,只需 HTML 标签添加到 Markdown 文本中即可。

行级內联标签

HTML 的行级內联标签如 <span><cite><del> 不受限制,可以在 Markdown 的段落、列表或是标题里任意使用。依照个人习惯,甚至可以不用 Markdown 格式,而采用 HTML 标签来格式化。

区块标签

区块元素──比如 <div><table><pre><p> 等标签,必须在前后加上空行,以便于内容区分。而且这些元素的开始与结尾标签,不可以用 tab 或是空白来缩进。Markdown 会自动识别这区块元素,避免在区块标签前后加上没有必要的

标签。

Code
1
2
3
4
5
6
7
8
9
This is a regular paragraph.

<table>
<tr>
<td>Foo</td>
</tr>
</table>

This is another regular paragraph.
Plaintext

This is a regular paragraph.

Foo

This is another regular paragraph.