Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathML support via MathJax (for advanced users, disabled by default) #644

Merged
merged 13 commits into from Nov 15, 2019

Conversation

@danielweck
Copy link
Collaborator

danielweck commented Aug 28, 2019

Fixes #643

Sample EPUB3 publication "linear algebra":
https://idpf.github.io/epub3-samples/30/samples.html#linear-algebra

"Before" screenshot:

ThoriumMathML

"After" screenshots:

ThoriumMathJaxMenu
ThoriumMathJaxAbout

@danielweck

This comment has been minimized.

Copy link
Collaborator Author

danielweck commented Aug 28, 2019

Current notable caveats:

  • By default, MathJax loads incrementally / in an async manner (which is good, because otherwise there would be a long / blocking rendering operation), so the "resize sensor" in r2-navigator-js is triggered many times, and the "reading location" event is emitted many times as well due to detected changes.
  • MathJax's popup menu is useful (and keyboard-accessible too), but it also interferes with document rendering (changes the viewport overflow, for example)
  • All MathJax-injected DOM markup must be skipped during selection/annotations (not a problem right now in Thorium, as not implemented yet), TTS / read-aloud with text-to-speech (again, not an immediate concern in Thorium), and more crucially in the "reading location" computations => we need a blacklisting mechanism for CSS classes and/or element IDs.
  • Right now in this prototype implementation, if HTML documents already contain an authored instance of MathJax, we don't attempt to detect it, and we "blindly" inject our own instance in the HTML head (via a script).
@danielweck

This comment has been minimized.

Copy link
Collaborator Author

danielweck commented Aug 28, 2019

Note that the chosen MathJax rendering method in this PR is the default CommonHTML one (not SVG, which was used in Readium1 due to technical limitations, although this was also a conscious design decision due to the opportunity to serve a single giant file MathJax.js which contained the SVG glyphs / paths instead of relying on external fonts)

@danielweck

This comment has been minimized.

Copy link
Collaborator Author

danielweck commented Aug 28, 2019

Overall, I think that MathJax should be an opt-in feature, which users could easily deactivate in case problems arise from it.

@danielweck danielweck changed the title WIP (DO NOT MERGE) MathML support via MathJax MathML support via MathJax (for advanced users, disabled by default) Nov 15, 2019
@danielweck danielweck merged commit 588aedd into develop Nov 15, 2019
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@danielweck danielweck deleted the feature/mathjax branch Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.