Search code examples
javascriptconfigurationmathjax

Prevent MathJax to append version to included JS


I can't prevent MathJax to append the version to each JS include?

To clarify, follows the snapshot from developer console:

developer tool network console

  • EDIT Add a config.js not workin

  • EDIT 2 Change with a simpler solution but still not working plus snippet

One possible solution, as I see in the code, is to override the cdnVersion property.

Follow the snapshot from MathJax.js of the default value property:

MathJax.cdnVersion = "2.7.1";  // specifies a revision to break caching

As suggest from Mathjax documentation ( http://docs.mathjax.org/en/latest/options/index.html ) you can use MathJax.Hub.Config() to do the job.

I tried with this config does not work:

MathJax.Hub.Config({
    config: ["MMLorHTML.js"],
    jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
    tex2jax: {inlineMath: [["$$","$$"]]},
    extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js"],
    TeX: {
        extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
    },
  cdnVersion: null
});

Follows a demo snippet:

MathJax.Hub.Config({
    config: ["MMLorHTML.js"],
    jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
    tex2jax: {inlineMath: [["$$","$$"]]},
    extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js"],
    TeX: {
        extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
    },
    cdnVersion: null
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"></script>


$$ \frac{3}{4}x^2 $$


Solution

  • It's not possible because they're not settings defined in config/default.js, from config documentation

    The various components of MathJax, including its input and output processors, its preprocessors, its extensions, and the MathJax core, all can be configured through the config/default.js file, or via a MathJax.Hub.Config() call (indeed, if you look closely, you will see that config/default.js is itself one big call to MathJax.Hub.Config()). Anything that is in config/default.js can be included in-line to configure MathJax.