2022 Answer
MathJax is now natively supported when viewing .md
files on GitHub. However, it is not automatically supported in GitHub Pages. To enable MathJax in GitHub Pages, the easiest option is to include the script from a CDN.
TAKE NOTE: the CDN has changed! The updated script tag to include is below. Add this script tag inside the <head/>
of your _layouts/default.html
file.
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
For more information, read the MathJax Docs page about using a CDN.
Additional Help
If you want to use dollar signs (i.e. $1 + 2$
) to escape math sequences, add the following as well:
<script>
MathJax = {
tex: {
inlineMath: [['$', '$']]
}
};
</script>
see the docs for more information.