From 50345aa627c1c62e472542b228bc6596c984465c Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Wed, 24 Jul 2019 11:49:12 +0800 Subject: [PATCH 1/2] Fix mathjax bug --- layout/_third-party/math/mathjax.swig | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/layout/_third-party/math/mathjax.swig b/layout/_third-party/math/mathjax.swig index f695c1a530..50d7a72d3e 100644 --- a/layout/_third-party/math/mathjax.swig +++ b/layout/_third-party/math/mathjax.swig @@ -18,22 +18,29 @@ } } }); + MathJax.Hub.Register.StartupHook('TeX Jax Ready', function() { MathJax.InputJax.TeX.prefilterHooks.Add(function(data) { if (data.display) { var next = data.script.nextSibling; - while (next && next.nodeName.toLowerCase() === '#text') { next = next.nextSibling } - if (next && next.nodeName.toLowerCase() === 'br') { next.parentNode.removeChild(next) } + while (next && next.nodeName.toLowerCase() === '#text') { + next = next.nextSibling + } + if (next && next.nodeName.toLowerCase() === 'br') { + next.parentNode.removeChild(next) + } } }); }); - - From 87404e44f397d9f8efd3ee13b4e7ac29ace6f01a Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Wed, 24 Jul 2019 11:58:12 +0800 Subject: [PATCH 2/2] Update --- layout/_third-party/math/mathjax.swig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/layout/_third-party/math/mathjax.swig b/layout/_third-party/math/mathjax.swig index 50d7a72d3e..47cb650e00 100644 --- a/layout/_third-party/math/mathjax.swig +++ b/layout/_third-party/math/mathjax.swig @@ -24,10 +24,10 @@ if (data.display) { var next = data.script.nextSibling; while (next && next.nodeName.toLowerCase() === '#text') { - next = next.nextSibling + next = next.nextSibling; } if (next && next.nodeName.toLowerCase() === 'br') { - next.parentNode.removeChild(next) + next.parentNode.removeChild(next); } } }); @@ -37,8 +37,8 @@ var all = MathJax.Hub.getAllJax(), i; for (i = 0; i < all.length; i += 1) { element = document.getElementById(all[i].inputID + '-Frame').parentNode; - if (element.tagName == 'LI') { - element = element.parentNode + if (element.nodeName.toLowerCase() == 'li') { + element = element.parentNode; } element.classList.add('has-jax'); }