This page will outline how to get gitlab markdown to render mathjax in a way that is mostly compatable with pandoc.
The first thing to do is add a plain text script to the view layout templates. This code should go into the file app/views/layouts/_mathjax.html.haml
:plain
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'] ],
processEscapes: true
}
});
</script>
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
Now, configuring the view haml files should be as easy as putting = render 'layouts/mathjax'
at the top of all of the following files:
app/views/projects/blob/show.html.haml
app/views/projects/issues/show.html.haml
app/views/projects/tree/show.html.haml
app/views/projects/wikis/show.html.haml
By default, gitlab has the (annoying) feature of using carrot as a superscript. This breaks mathjax for ever equation with a superscript, so to turn it off in the file app/helpers/gitlab_markdown_helper.rb
. Simply set superscript to false.