Jekyll and Mathjax

Two suggestions.

Put your code inside an HTML file, so markdown like _ is not evaluated.

For example

_includes/math.html

<script type="text/x-mathjax-config">
// ...
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full"></script>

Use in a markdown or HTML page (or layout) as:

{% include math.html %}

Put your code inside a raw tag. This helps to stop Liquid templating e.g. {{ }} is Moustache.js syntax that must not be evaluated by Jekyll.
I don’t know if this will prevent _foo_ from becoming <em>foo</em>

This code will be evaluated.

{{ site.description }}

{% raw %}
This code will stay as plain text and will not be evaluated by Jekyll

{{ site.description }}
{% endraw %}


This code will also be evaluated.

{{ site.description }}
1 Like