orsharir / github-mathjax

Chrome extension for rendering LaTeX equations in GitHub with MathJax
Other
153 stars 49 forks source link

Opt-out for some file types #32

Open alf239 opened 4 years ago

alf239 commented 4 years ago

Scala's diffs are a mess with the plugin: when you have an interpolated srting, it is likely to have some $s in it, and those are treated as \LaTeX which is a bit strange in the context.

Is there a way to suppress MathJax processing for specific file types?

alf239 commented 4 years ago

The MathJax.Hub.Typeset() command also accepts a parameter that is a DOM element whose contents is to be typeset. That could be a paragraph, or a <div> element, or even a MathJax math <script> tag. It could also be a the DOM id of such an object, in which case, MathJax will look up the DOM element for you. So

MathJax.Hub.Queue(["Typeset",MathJax.Hub,"MathExample"]);

would typeset the mathematics contained in the element whose id is MathExample. This is equivalent to

var math = document.getElementById("MathExample");
MathJax.Hub.Queue(["Typeset",MathJax.Hub,math]);

If no element or element id is provided, the whole document is typeset.

And it seems that the Scala sources can be identified by an attribute data-file-type=".scala" in a div that's before the parent div with class js-file-content Details-content--hidden