From c757968bf7f36ccb71cd80a3fb730ab1f4b8bdd7 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sun, 3 Nov 2019 21:46:49 +0000 Subject: [PATCH] Ensure KaTeX renders mbox latex by using fbox instead Former-commit-id: 8de6c00688e6b9451835efb6d8fcc0d128bd2083 [formerly a45ac98da9213213194ccd141f0f30fecf4b0d4b] Former-commit-id: ba63907396e85eb61bfa6dbccc13e0ed5f864eb5 --- www/js/app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/www/js/app.js b/www/js/app.js index 4c337e1d..e6b999f9 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -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 ''; }); // 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(/&/g, '&'); + // Change any mbox commands to fbox (because KaTeX doesn't support mbox) + math = math.replace(/mbox{/g, 'fbox{'); return p1 + math + p4 + ''; }); }