Skip to content

Commit

Permalink
Fix list rendering problem when list item contains mathjax formulae (t…
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored Jul 24, 2019
1 parent 5c08345 commit e8bb98b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions layout/_third-party/math/mathjax.swig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
});
});
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for (i = 0; i < all.length; i += 1) {
document.getElementById(all[i].inputID + '-Frame').parentNode.className += ' has-jax';
element = document.getElementById(all[i].inputID + '-Frame').parentNode;
if (element.nodeName.toLowerCase() == 'li') {
element = element.parentNode;
}
element.classList.add('has-jax');
}
});
</script>
Expand Down

0 comments on commit e8bb98b

Please sign in to comment.