reader-view icon indicating copy to clipboard operation
reader-view copied to clipboard

MathJax is not rendered

Open Dimension4 opened this issue 1 year ago • 2 comments

I was starting to read https://discrete.openmathbooks.org/dmoi3/sec_intro-intro.html and found this extension, which I really like. Unfortunately, it doesn't seem to render any MathJax equations.

This paragraph image

is renderer as image

Another example image and image

Happens on Chrome Version 129.0.6668.71 (Official Build) (64-bit) and Firefox 130.0.1 (64-bit).

Dimension4 avatar Sep 27 '24 08:09 Dimension4

I'm seeing this as well. It looks like MathJax dependencies are present in /v2 but absent in /v3 and the feature wasn't removed from the documentation (the extension in the Chrome Webstore is /v3). Just for kicks I attempted a crude recreation of the v2 dependency config in v3:

  • Add <script src="libs/mathjax/do.js"></script> in template.html
  • Replace v3's Readability.js with the version used in v2

If you then set a breakpoint in mathjax/do.js, you'll see that document has already been sanitized by Readability and all MathJax tags are removed before they can be rendered. It appears the only attempt to preserve equations in Readability.js is to retain wikimedia math images.

So, the issue is with Mozilla's Readability.js and it looks like someone started working on a patch.

AlexTate avatar Feb 18 '25 02:02 AlexTate

Appending |MathJax to REGEXPS.okMaybeItsACandidate should do it.

With that change the demos on MathJax-demos-web seem to be rendering correctly in reader-view, but I'll admit I hadn't heard of MathJax until today so there might be some nuance I'm not picking up on.

AlexTate avatar Feb 18 '25 02:02 AlexTate