Skip to content

setup gogs to display math in Markdown via Mathjax:

  • go to file /opt/gogs/templates/base/head.tmpl

  • insert following lines into <head></head> section:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"] ],
          displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
          processEscapes: true
        },
        "HTML-CSS": { availableFonts: ["TeX"] }
      });
    </script>
    <script type="text/javascript" async
      src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
    </script>