Inline math rendering when using pelican and liquid tags

226 Views Asked by At

liquid_tags fails to render inline math for me. I managed to have inline math rendered properly when using "plain" markdown. See for example this example with sources available here.

However, inline math in a Jupyter notebook is not rendered properly even though it does look OK inside the Jupyter environment. An example can be found in the following places:

As you can see, Github renders the inline math properly, but when included in a post, this breaks. I failed to understand where the problem is. Any help would be appreciated.

Update 1: It seems like the function init_mathjax() is not executed when the HTML page is loaded. If I run it manually from the page's console, the inline math is rendered properly.

PS: I posted this also as an issue on the project's GitHub (link)

1

There are 1 best solutions below

0
On

TL;DR: In Pelican-plugins/liquid_tags/notebook.py replace

<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>

with

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>

It seems like the problem is due to this commit where async loading of MathJax was introduced. I fixed/reverted it in my fork and now rendering of inline math works as expected.