I want to use MathML on my cards directly because I have written a 1000 page (HTML + MathML) document that I have perfectly formatted that I can relatively easily split into anki cards.
Anki desktop currently uses Chrome 77.
In the future if Anki ever incorporates Chrome version 109, then Anki will inherit the native MathML support. See Chrome 109 release details ( link: chromiumdash.appspotLINKREMOVED/schedule ).
Before Anki supports MathML natively, I want to use Mathjax’s MathML input jax component (link: docs.mathjaxLINKREMOVED/en/latest/web/components/input.html#input-mml) to convert (for example) <msup><mi>b</mi><mn>2</mn></msup>
to Mathjax’s HTML output.
Using webinspector I can see that Anki (Desktop) loads Mathjax like this (in LINKREMOVED://127.0.0.1:57484/_anki/legacyPageData?id=4929489936)
<script src="LINKREMOVED:57484/_anki/js/webview.js"></script>
<script src="LINKREMOVED:57484/_anki/js/mathjax.js"></script>
<script src="LINKREMOVED:57484/_anki/js/vendor/mathjax/tex-chtml.js"></script>
<script src="LINKREMOVED:57484/_anki/js/reviewer.js"></script>
However, I need assistance in loading the MathML input jax into the existing Mathjax configuration. I don’t want to load my own copy of Mathjax because Anki seems to have wired Mathjax in so that it typesets correctly as you move between cards and view the reverse etc. I want to use this feature so that typesetting is rerun at the appropriate point in time.
Instead of loading tex-chtml.js
(the third script import), one approach may be to load tex-mml-chtml.js
as suggested here (link: docs.mathjaxLINKREMOVED/en/latest/web/start.html#using-mathjax-from-a-content-delivery-network-cdn) under the warning section.
However, I cannot work out how edit to the legacyPageData
html page to change this script url.
QUESTION 1: How do I edit legacyPageData
html page?
Another approach is to add a script to a card template, but I get errors because I don’t think the raw js
files for the components are available. Again, I want to use the existing Mathjax object so that it reruns the typesetting at the appropriate points in time.
In the console of webinspector, I can access the existing Mathjax object with window.MathJax
.
However, I have been unsuccessful using the load
method as described around the configuring mathjax after it is loaded section (link:
docs.mathjaxLINKREMOVED/en/latest/web/configuration.html#configuring-mathjax-after-it-is-loaded)
QUESTION 2: Can someone assist me with this loading of an input jax after the initial load? Happy to provide more details if necessary.
(Forum admin: Not allowing links in post leads to lower quality posts. I had to remove all my URLs that I spent half an hour creating).