notebox

Enabling MathJax support on Github pages

Github does have MathJax rendering when rendering math equations from markdown in its built-in markdown preview, but when the same markdown with math equations get deployed to Github pages, the math rendering support is provided by the Jekyll theme instead.

The default Jekyll theme used by Github pages does not support MathJax rendering out of the box, but it is easy to get it going.

Just create _includes/head-custom.html with the following:

 <!-- MathJax -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" 
    async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>

<script id="text/javascript">
  window.MathJax = {
   tex: {
     inlineMath: [['$', '$'], ['\\(', '\\)']]
   }
  };
</script>

Explaination:

  1. 20221127122723 MathJax: Tex and LaTeX Math delimiters