Satisfy formatter

This commit is contained in:
Henrik Giesel 2020-11-15 21:21:04 +01:00
parent a7b5a7efe1
commit 435ecc3ae8
2 changed files with 34 additions and 39 deletions

View File

@ -1,34 +1,28 @@
window.MathJax = { window.MathJax = {
tex: { tex: {
displayMath: [["\\[", "\\]"]], displayMath: [["\\[", "\\]"]],
processRefs: false, processRefs: false,
processEnvironments: false, processEnvironments: false,
packages: { packages: {
'[+]': [ "[+]": ["noerrors", "mhchem"],
'noerrors', },
'mhchem',
],
}
},
startup: {
typeset: false,
pageReady: () => {
console.log('page is ready');
return MathJax.startup.defaultPageReady();
}, },
}, startup: {
options: { typeset: false,
renderActions: { pageReady: () => {
addMenu: [], console.log("page is ready");
checkLoading: [] return MathJax.startup.defaultPageReady();
},
},
options: {
renderActions: {
addMenu: [],
checkLoading: [],
},
ignoreHtmlClass: "tex2jax_ignore",
processHtmlClass: "tex2jax_process",
},
loader: {
load: ["[tex]/noerrors", "[tex]/mhchem"],
}, },
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process',
},
loader: {
load: [
'[tex]/noerrors',
'[tex]/mhchem',
]
}
}; };

View File

@ -39,13 +39,13 @@ function _updateQA(html, fadeTime, onupdate, onshown) {
var qa = $("#qa"); var qa = $("#qa");
// fade out current text // fade out current text
qa.fadeOut(fadeTime).promise() qa.fadeOut(fadeTime)
.promise()
// update text // update text
.then(() => { .then(() => {
try { try {
qa.html(html) qa.html(html);
} } catch (err) {
catch (err) {
qa.html( qa.html(
( (
`Invalid HTML on card: ${String(err).substring(0, 2000)}\n` + `Invalid HTML on card: ${String(err).substring(0, 2000)}\n` +
@ -55,19 +55,20 @@ function _updateQA(html, fadeTime, onupdate, onshown) {
} }
}) })
.then(() => _runHook(onUpdateHook)) .then(() => _runHook(onUpdateHook))
// @ts-ignore wait for mathjax to ready .then(() =>
.then(() => MathJax.startup.promise // @ts-ignore wait for mathjax to ready
.then(() => { MathJax.startup.promise.then(() => {
// @ts-ignore clear MathJax buffer // @ts-ignore clear MathJax buffer
MathJax.typesetClear(); MathJax.typesetClear();
// @ts-ignore typeset // @ts-ignore typeset
return MathJax.typesetPromise(qa.slice(0, 1)); return MathJax.typesetPromise(qa.slice(0, 1));
})) })
)
// and reveal when processing is done // and reveal when processing is done
.then(() => qa.fadeIn(fadeTime).promise()) .then(() => qa.fadeIn(fadeTime).promise())
.then(() => _runHook(onShownHook)) .then(() => _runHook(onShownHook))
.then(() => _updatingQA = false); .then(() => (_updatingQA = false));
} }
function _showQuestion(q, bodyclass) { function _showQuestion(q, bodyclass) {