woodie / common-cartridge-viewer

View Common Cartridges in the browser
https://common-cartridge-viewer.netlify.com
MIT License
1 stars 0 forks source link

LaTeX support with MathJax #3

Open woodie opened 6 months ago

woodie commented 6 months ago

We see a single-page cartridge can be patched, but we need to identifying the appropriate place to call MathJax.startup.defaultReady() so that we only load MathJax once, but then typeset 0each fragment as additional pages are selected in the viewer.

https://github.com/instructure/common-cartridge-viewer/pull/201/files

# src/Resource.js
+ const script = document.createElement("script");
+ script.src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";
+ script.async = true;
+ document.body.appendChild(script);