Skip to content

Commit

Permalink
fix: workaround for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Aug 8, 2020
1 parent c9a817a commit d9f7dd8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ math:
options:
throwOnError: false
mathjax:
css: 'https://cdn.jsdelivr.net/gh/hexojs/hexo-math/master/dist/style.css'
css: 'https://cdn.jsdelivr.net/gh/hexojs/hexo-math/dist/style.css'
options:
conversion:
display: false
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ hexo.config.math = Object.assign({
}
},
mathjax: {
css: 'https://cdn.jsdelivr.net/gh/hexojs/hexo-math/master/dist/style.css',
css: 'https://cdn.jsdelivr.net/gh/hexojs/hexo-math/dist/style.css',
options: {
// https://docs.mathjax.org/en/latest/web/typeset.html#conversion-options
conversion: {
Expand Down
6 changes: 3 additions & 3 deletions lib/katex.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ module.exports = hexo => {
const { katex: fmCfg } = this;
const [jsonCfg] = args;
const argsCfg = jsonCfg ? JSON.parse(jsonCfg) : false;
let options = Object.assign({}, globalCfg);
if (fmCfg) options = Object.assign({}, options, fmCfg);
if (argsCfg) options = Object.assign({}, options, argsCfg);
let options = { ...globalCfg };
if (fmCfg) options = { ...options, ...fmCfg };
if (argsCfg) options = { ...options, ...argsCfg };

return renderKatex(content, options);
};
Expand Down
8 changes: 5 additions & 3 deletions lib/mathjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ module.exports = hexo => {
const { mathjax: fmCfg } = this;
const [jsonCfg] = args;
const argsCfg = jsonCfg ? JSON.parse(jsonCfg) : false;
let options = Object.assign({}, globalCfg);
if (fmCfg) options = Object.assign({}, options, fmCfg);
if (argsCfg) options = Object.assign({}, options, argsCfg);
let options = { ...globalCfg };
if (fmCfg) options = { ...options, ...fmCfg };
if (argsCfg) options = { ...options, ...argsCfg };
const { conversion, svg, tex } = options;

const MathJax = await init({
loader: {
// https://github.com/mathjax/MathJax/issues/2486
paths: { mathjax: 'mathjax/es5' },
load: ['input/tex', 'output/svg']
},
tex,
Expand Down

0 comments on commit d9f7dd8

Please sign in to comment.