Gollum: MathJax out of date

Created on 22 Feb 2021  路  4Comments  路  Source: gollum/gollum

Describe the bug
Not a bug per se, however the version of MathJax used when --mathjax is specified is quite out of date.
Echoing window.MathJax.version in the console yields 2.7.5, while the latest MathJax version is 3.1.2. This is also not even the latest v2 version, as that is 2.7.9 (as per MathJax's GitHub page).

Environment Info

Gollum 5.1.2
Running on: universal.x86_64-darwin20 with Ruby version 2.6.3
Using:
rugged 0.99.0
gollum-rugged_adapter 1.0
gollum-lib 5.0.6
Markdown rendering gem: kramdown
Other renderering gems:
RedCloth 4.2.9

Most helpful comment

Actually, even Primer, the CSS framework we use, recommends we manage it as an NPM module. It is not unusual for Ruby projects to manage a package.json with auxiliary NPM modules with yarn.

I will plan submit a PR setting this up. I think the only development pain point is this would be another regular compile step like sprockets, which isn鈥檛 that bad.

All 4 comments

After taking a look at the code, it seems that MathJax is bundled directly. Perhaps there should be the option to fetch MathJax from a custom URL? --mathjax-url would be a good switch to use. For now I actually had to copy the entire mustache templates directory in order to just change this:

  <script>
    MathJax = {
      tex: {
        inlineMath: [['$', '$'], ['\(', '\)']],
        displayMath: [['$$', '$$'], ['\[', '\]']],
        processEscapes: true
      }
    };
  </script>

  <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>

Outdated mathjax is a known issue, see the discussion in https://github.com/gollum/gollum/issues/1404, but I actually don't mind having a separate Github issue for this.

it seems that MathJax is bundled directly.

The main reason for bundling MathJax is to ensure that math rendering will continue to work offline. I guess if you really wanted you could load the newer version of MathJax from custom.js in the meantime.

It would be great if there was a way to easily manage JS assets in ruby projects, so we didn't have to do manual updates all the time. :( Perhaps @benjaminwil will know what best practices are at the moment?

Still, updating ace will probably also require some minor tweaks to the settings here.

Actually, even Primer, the CSS framework we use, recommends we manage it as an NPM module. It is not unusual for Ruby projects to manage a package.json with auxiliary NPM modules with yarn.

I will plan submit a PR setting this up. I think the only development pain point is this would be another regular compile step like sprockets, which isn鈥檛 that bad.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

waltharius picture waltharius  路  7Comments

thomaskuntzz picture thomaskuntzz  路  3Comments

jb2cool picture jb2cool  路  3Comments

Fastidious picture Fastidious  路  4Comments

snhirsch picture snhirsch  路  4Comments