-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathindex.js
executable file
·33 lines (28 loc) · 1.02 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
/* global hexo */
'use strict';
hexo.config.math = Object.assign({
katex: {
css: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
options: {
throwOnError: false
}
},
mathjax: {
css: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/style.css',
options: {
// https://docs.mathjax.org/en/latest/web/typeset.html#conversion-options
conversion: {
display: false
},
// https://docs.mathjax.org/en/latest/options/input/tex.html
tex: {},
// https://docs.mathjax.org/en/latest/options/output/svg.html
svg: {}
}
}
}, hexo.config.math);
const config = hexo.config.math;
hexo.extend.tag.register('katex', require('./lib/katex')(hexo), true);
hexo.extend.tag.register('mathjax', require('./lib/mathjax')(hexo), { ends: true, async: true });
if (config.katex.css) hexo.extend.injector.register('head_end', require('./lib/inject/katex')(hexo));
if (config.mathjax.css) hexo.extend.injector.register('head_end', require('./lib/inject/mathjax')(hexo));