Markdown-it渲染器扩展

写文章的第一步是啥?当然是学写字~

本着善其事利其器的原则,替换掉了默认的渲染器,采用了markdown-it.
用作者的话说它扩展性比较强,功能更丰富,传说处理速度也比较快~

The killer feature of markdown-it is very effective support of syntax plugins.

本篇作为Markdown(非标准)的语法参考手册及检测后续样式修改的基准测试页

项目地址


https://github.com/hexojs/hexo-renderer-markdown-it

语法


结构

标题

1
2
3
4
5
6
# Title of h1
## Title of h2
### Title of h3
#### Title of h4
##### Title of h5
###### Title of h6

Title of h1

Title of h2

Title of h3

Title of h4

Title of h5
Title of h6

水平线

1
2
3
___
---
***



资源

图片

1
2
![Markdown Logo](http://kirkstrobeck.github.io/whatismarkdown.com/img/markdown.png)
markdown不支持设置图像尺寸,暂时用HTML原生的img标签

链接

1
[EMOJI CHEAT SHEET](http://www.emoji-cheat-sheet.com/ "Emoji!")

EMOJI CHEAT SHEET

文字效果

粗体

1
2
**bold**
__bold__

bold

斜体

1
2
*italic*
_italic_

italic

删除线

1
~~Strikethrough~~

Strikethrough

引用块

1
2
> Blockquotes
>> Nest

Blockquotes

Nest

行内代码

1
There is a `code` inline.

There is a code inline.

代码块

1
2
3
4
5
6
7
```javascript
function foo(bar) {
if(bar) {
return "";
}
}
```
1
2
3
4
5
function foo(bar) {
if(bar) {
return "";
}
}

无序列表

1
2
3
4
* Unordered List
* Level 1
* Level 2
* Level 3
  • Unordered List
  • Level 1
    • Level 2
      • Level 3

有序列表

1
2
3
1. Ordered List
2. Item
3. Item
  1. Ordered List
  2. Item
  3. Item

表格

1
2
3
4
|   |col1|col2
|---|----|----
|row1|a|b
|row2|c|d
col1 col2
row1 a b
row2 c d

特殊符

Emoji

1
:grinning: :kissing_heart: :flushed:

😀 😘 😳

印刷字符

1
(c) (C) (r) (R) (tm) (TM) (p) (P) +-

© © ® ® ™ ™ § § ±

上下标

1
2
21^th^
H~2~O

21th
H2O

缩写

1
2
GNU is a famous organization
*[GNU]: GNU's Not Unix

GNU is a famous organization

尾注

1
2
3
4
5
6
7
8
9
10
11
12
13
Footnote 1 link[^first].

Footnote 2 link[^second].

Inline footnote^[Text of inline footnote] definition.

Duplicated footnote reference[^second].

[^first]: Footnote **can have markup**

and multiple paragraphs.

[^second]: Footnote text.

Footnote 1 link[1].

Footnote 2 link[2].

Inline footnote[3] definition.

Duplicated footnote reference[2].


  1. Footnote can have markup

    and multiple paragraphs.

  2. Footnote text.

  3. Text of inline footnote