内容目录

在段落中填写 [TOC] 以显示全文内容的目录结构。

文章头格式

front-matter 的基本格式示例如下:

1
2
3
4
5
6
7
8
---
title: Hexo Markdown-it 简明语法手册
date: 2016-01-15 20:19:32
tags: [Markdown,LaTex,教程]
categories: 学习
toc: true
mathjax: true
---

斜体和粗体

使用 * 和 ** 表示斜体和粗体,格式如下:

1
*斜体*, **粗体**

渲染效果: 这是 斜体,这是 粗体 。

分级标题

使用 === 表示一级标题,使用 --- 表示二级标题,格式如下:

1
2
3
4
5
6
7
这是一个一级标题
============================

这是一个二级标题
--------------------------------------------------

### 这是一个三级标题

你也可以选择在行首加#号表示不同级别的标题 (H1-H6),格式如下:

1
2
3
4
5
6
# H1
## H2
### H3
#### H4
##### H5
###### H6

分割线

在单独的一行使用 *** 或者 --- 表示分割线

删除线

使用 ~~ 表示删除线
这是一段错误的文本。

超链接

插入文字超链接的格式如下 :

1
[链接文字](链接地址 "链接标题")

插入图片超链接的格式如下:

1
![图片说明](图片链接 "图片标题")

插入音频,使用插件hexo-tag-aplayer,语法如下:

1
{% aplayer title author url [picture_url, narrow, autoplay, width:xx%, lrc:xxx] %}

详情参见:hexo-tag-aplayer 中文使用文档

引用视频则直接插入iframe代码:

1
2
<script src="/js/youtube-autoresizer.js"></script>
<iframe width="640" height="360" src="https://www.youtube.com/embed/HfElOZSEqn4" frameborder="0" allowfullscreen></iframe>

文字:本博客链接

图片: Google的logo

视频:

***

注释

用 \ 表示注释,\ 后面的文字解析为纯文本格式。
渲染效果:
## 这不是二级标题

引用

使用 > 表示文字引用:

1
> 野火烧不尽,春风吹又生

野火烧不尽,春风吹又生

脚注

使用 [^1] [^1]: 的脚注对来表示

1
2
3
4
5
6
7
Here is a footnote reference,[^1] and another.[^longnote]

[^1]: Here is the footnote.

[^longnote]: Here's one with multiple blocks.
Subsequent paragraphs are indented to show that they
belong to the previous footnote.

Here is a footnote reference,[1] and another.[2]

列表与表格

无序列表

使用 *,+,- 表示无序列表。

1
2
3
4
5
6
+ 无序列表项 一
- 子无序列表 一
- 子无序列表 二
* 子无序列表 三
+ 无序列表项 二
+ 无序列表项 三

  • 无序列表项 一
    • 子无序列表 一
    • 子无序列表 二
      • 子无序列表 三
  • 无序列表项 二
  • 无序列表项 三

有序列表

使用数字和点表示有序列表。

1
2
3
4
5
1. 有序列表项 一
1. 子有序列表项 一
2. 子有序列表项 二
2. 有序列表项 二
3. 有序列表项 三

  1. 有序列表项 一
    1. 子有序列表项 一
    2. 子有序列表项 二
  2. 有序列表项 二
  3. 有序列表项 三

绘制表格

绘制表格格式如下,| 控制分列,- 控制分行,: 控制对齐方式。

1
2
3
4
5
| Item     | Value     | Qty   |
| :------- | --------: | :---: |
| Computer | 1600 USD | 5 |
| Phone | 12 USD | 12 |
| Pipe | 1 USD | 234 |

Item Value Qty
Computer 1600 USD 5
Phone 12 USD 12
Pipe 1 USD 234

代码块

行内代码块

使用 `codes` 表示行内代码块。

渲染效果: 让我们聊聊 html 。

多行代码块

1
2
3
这是用 ``` some codes ```表示的代码块(左侧无空格);
第二行;
第三行。

加强的代码块

支持多种编程语言的语法高亮的显示,行号显示。

非代码示例:

1
$ sudo apt-get install vim-gnome

Python 示例:

1
2
3
4
5
6
7
8
9
10
11
12
requires_authorization
def somefunc(param1='', param2=0):
'''A docstring'''
if param1 > param2: # interesting
print 'Greater'
return (param2 - param1 + 1) or None

class SomeClass:
pass

>>> message = '''interpreter
... prompt'''

JavaScript 示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
* nth element in the fibonacci series.
* @param n >= 0
* @return the nth element, >= 0.
*/
function fib(n) {
var a = 1, b = 1;
var tmp;
while (--n >= 0) {
tmp = a;
a += b;
b = tmp;
}
return a;
}

document.write(fib(10));

LaTeX 公式

数学公式的默认定界符是$...$和\\(...\\)(对于行内公式),以及$$...$$和\\[...\\](对于块级公式)。
但是,如果你的文章内容中经常出现美元符号$,或者说你想将“$”用作美元符号而非行内公式的定界符,请在Hexo目录的_config.yml中添加:

1
mathjax2: true

而不是mathjax: true。 相应地,在需要使用数学公式的文章的front-matter中也添加mathjax2: true。

例如:

质能守恒方程: $E = mc^2$: $E = mc^2$

长度收缩:$x' = {x - vt \over \sqrt{1 - {v^2 \over c^2}}}$: $x’ = {x - vt \over \sqrt{1 - {v^2 \over c^2}}}$

表示块级公式:

1
$$\Delta_A(\lambda)=\det(\lambda I-A)$$

$$\Delta_A(\lambda)=\det(\lambda I-A)$$

或者:

1
2
3
\begin{equation}
\Delta_A(\lambda)=\det(\lambda I-A),
\end{equation}

\begin{equation}
\Delta_A(\lambda)=\det(\lambda I-A),
\end{equation}

1
2
3
4
5
\begin{aligned}
\dot{x} & = \sigma(y-x) \\\
\dot{y} & = \rho x - y - xz \\\
\dot{z} & = -\beta z + xy
\end{aligned}

(此处需注意换行符转义,多加一个\)

\begin{aligned}
\dot{x} & = \sigma(y-x) \
\dot{y} & = \rho x - y - xz \
\dot{z} & = -\beta z + xy
\end{aligned}

1
2
3
4
5
6
7
8
9
\begin{equation}
[a, b, c]=\left|
\begin{array}{ccc}
a_1& a_2 & a_3 \\\
b_1 &b_2 & b_3 \\\
c_1 &c_2 &c_3
\end{array}
\right|
\end{equation}

\begin{equation}
[a, b, c]=\left|
\begin{array}{ccc}
a_1& a_2 & a_3 \
b_1 &b_2 & b_3 \
c_1 &c_2 &c_3
\end{array}
\right|
\end{equation}

访问 MathJax basic tutorial and quick reference 参考更多使用方法。


  1. Here is the footnote. ↩

  2. Here’s one with multiple blocks.
    Subsequent paragraphs are indented to show that they
    belong to the previous footnote. ↩