From e8bb98b92c92a5d2194142db87c6168c1ee5ab58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=8D=C9=AA=E1=B4=8D=C9=AA?= <1119186082@qq.com> Date: Wed, 24 Jul 2019 12:19:25 +0800 Subject: [PATCH] Fix list rendering problem when list item contains mathjax formulae (#1004) --- 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..47cb650e00 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); + } } }); }); - -