0

I am using Gitlab Pages to host a documentation generated with Sphinx.

Is it possible to render math with MathJax using Gitlab Pages? From my testing, equations are not rendered. Do I need to install MathJax along with doc in order for this to work? The generated documentation render properly on a local machine.

tupui
  • 5,738
  • 3
  • 31
  • 52

2 Answers2

1

No. From: https://docs.gitlab.com/ee/user/project/pages/getting_started_part_one.html#static-sites

GitLab Pages only supports static websites, meaning, your output files must be HTML, CSS, and JavaScript only.

It would be up to you to render the static site through a process either on your local computer and pushing the result to your repository or with continuous integration using GitLab CI. Here's a blog post where GitLab uses Nanoc instead of Sphinx, but you could replace it in your CI.

Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
  • To complet the information. MathJax path can be set to a local installation which is relative to `_static` (http://www.sphinx-doc.org/en/stable/ext/math.html#confval-mathjax_path). So in my CI script, I use this: `- wget -O /tmp/z.$$ https://github.com/mathjax/MathJax/archive/master.zip && unzip -d _static /tmp/z.$$ && rm /tmp/z.$$` – tupui Nov 25 '17 at 10:12
0

I'm not using Sphinx but a different static site generator for gitlab pages. Rendering with mathjax is working perfectly fine for me. I didn't have to do anything special, I just have the following snippet in my <head> element:

<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>
Max Baroi
  • 31
  • 1
  • 4