Skip to content

Commit

Permalink
Forward Plugin Parameters to mathjax-node-page
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag authored Jan 7, 2021
1 parent 9bab05c commit 2979fa1
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/builtin_plugins/mathjax/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ const mjpage = require('mathjax-node-page')

exports.constructor = async function (params) {
return {
htmlModifiers: [ asyncMathjax ]
htmlModifiers: [asyncMathjax(params)]
}
}

var asyncMathjax = async function (html) {
return new Promise(resolve => {
mjpage.mjpage(html, {
format: ['TeX']
}, {
mml: true,
css: true,
html: true
}, response => resolve(response))
})
}
var asyncMathjax =
(params) => {
console.log(params);
return async (html) => {
return new Promise(resolve => {
mjpage.mjpage(html, {
format: ['TeX'],
...params
}, {
mml: true,
css: true,
html: true,
}, response => resolve(response))
})
}
}

0 comments on commit 2979fa1

Please sign in to comment.