Ensure KaTeX renders mbox latex by using fbox instead

Former-commit-id: 8de6c00688e6b9451835efb6d8fcc0d128bd2083 [formerly a45ac98da9213213194ccd141f0f30fecf4b0d4b]
Former-commit-id: ba63907396e85eb61bfa6dbccc13e0ed5f864eb5
This commit is contained in:
Jaifroid 2019-11-03 21:46:49 +00:00
parent 23beda71e7
commit c757968bf7

View File

@ -2710,6 +2710,8 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
function (p0, p1, math) {
// Remove any rogue ampersands in MathJax due to double escaping (by Wikipedia)
math = math.replace(/&/g, '&');
// Change any mbox commands to fbox (because KaTeX doesn't support mbox)
math = math.replace(/mbox{/g, 'fbox{');
return '<script type="math/tex">' + math + '</script>';
});
// Deal with any newer MathML blocks
@ -2717,6 +2719,8 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
function (_p0, p1, _p2, math, p4) {
// Remove any rogue ampersands in MathJax due to double escaping (by Wikipedia)
math = math.replace(/&amp;/g, '&');
// Change any mbox commands to fbox (because KaTeX doesn't support mbox)
math = math.replace(/mbox{/g, 'fbox{');
return p1 + math + p4 + '<script type="math/tex">' + math + '</script>';
});
}