Skip to content

Instantly share code, notes, and snippets.

@pkra
Created July 28, 2015 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pkra/794a1d9a35ae2428eaff to your computer and use it in GitHub Desktop.
Save pkra/794a1d9a35ae2428eaff to your computer and use it in GitHub Desktop.
// add to User:YOURNAME/common.js to get smooth MathJax rendering
var mathTags = $('.mwe-math-mathml-a11y');
if (mathTags.length > 0){ //only do something when there's math on the page
window.MathJax = {
SVG: {blacker: 1}, // clearer SVG output, in case people switch to SVG output
AuthorInit: function () {
MathJax.Hub.Register.StartupHook("End",function () { //when MathJax is done...
MathJax.Hub.Queue(
function(){
mathTags.removeClass('mwe-math-mathml-a11y'); // .. make the span around MathML (now MathJax output) visible
$('.mwe-math-fallback-image-inline').addClass('mwe-math-mathml-a11y'); //remove the SVG image thingie
}
);
});
}
};
mw.loader.load('https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_HTMLorMML');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment