-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
index.js
46 lines (38 loc) · 1.23 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* global hexo */
'use strict';
hexo.config.markdown = Object.assign({
preset: 'default',
render: {},
anchors: {}
}, hexo.config.markdown);
hexo.config.markdown.render = Object.assign({
html: true,
xhtmlOut: false,
breaks: true,
linkify: true,
typographer: true,
quotes: '“”‘’'
}, hexo.config.markdown.render);
hexo.config.markdown.anchors = Object.assign({
level: 2,
collisionSuffix: '',
permalink: false,
permalinkClass: 'header-anchor',
permalinkSide: 'left',
permalinkSymbol: '¶',
case: 0,
separator: '-'
}, hexo.config.markdown.anchors);
const Renderer = require('./lib/renderer');
const renderer = new Renderer(hexo);
renderer.disableNunjucks = Boolean(hexo.config.markdown.disableNunjucks);
function render(data, options) {
return renderer.render(data, options);
}
hexo.extend.renderer.register('md', 'html', render, true);
hexo.extend.renderer.register('markdown', 'html', render, true);
hexo.extend.renderer.register('mkd', 'html', render, true);
hexo.extend.renderer.register('mkdn', 'html', render, true);
hexo.extend.renderer.register('mdwn', 'html', render, true);
hexo.extend.renderer.register('mdtxt', 'html', render, true);
hexo.extend.renderer.register('mdtext', 'html', render, true);