#5616·anki

Previewer and card layout still load MathJax eagerly

Author: aarianmmCreated Sep 16, 2026Updated Sep 16, 2026

#5171 made the reviewer load MathJax on demand and removed the eager script tags from qt/aqt/reviewer.py. The previewer and the card layout screen build on the same reviewer page, but were not updated, and still load it unconditionally:

  • qt/aqt/browser/previewer.py:152-153
  • qt/aqt/clayout.py:365-366
python
js=[
    "js/mathjax.js",
    "js/vendor/mathjax/tex-chtml-full.js",
    "js/reviewer.js",
],

Both screens render through _showQuestion / _showAnswer, which call _updateQA in ts/reviewer/index.ts. That already awaits _lazyLoadMathJax() when the content contains MathJax delimiters, so the eager tags look redundant — they just make every user of those screens pay for tex-chtml-full.js upfront, which is what #5172 set out to avoid.

Neither file touches the MathJax API from Python, so removing the two lines from each should defer the load to the same point the reviewer uses.

Tangentially related: these are also two of the four remaining places that hardcode the tex-chtml-full.js filename, which #4464 (MathJax v4) drops from the vendored file set.