Upgrade to MathJax v3 (replaces retired cdn.mathjax.org)#38
Open
aoboturov wants to merge 2 commits intodeepgenerativemodels:masterfrom
Open
Upgrade to MathJax v3 (replaces retired cdn.mathjax.org)#38aoboturov wants to merge 2 commits intodeepgenerativemodels:masterfrom
aoboturov wants to merge 2 commits intodeepgenerativemodels:masterfrom
Conversation
added 2 commits
May 5, 2026 13:30
The cdn.mathjax.org CDN was retired in 2017 (see https://www.mathjax.org/cdn-shutting-down/), which broke all math rendering on the site. Switch to jsdelivr's MathJax v2 mirror, keeping v2 because the inline MathJax.Hub.Config is v2-API.
The v2 jsdelivr swap got the script loading again, but two follow-up
issues remained: v2's HTML-CSS renderer was missing the calligraphic
webfont (\mathcal{D} rendered as tofu), and v3 by default ignores
kramdown's <script type="math/tex"> wrappers and $...$ inline math.
Changes:
- Move MathJax config from _layouts/post.html into _includes/head.html
so it's set before the loader (required by v3).
- Convert v2 MathJax.Hub.Config syntax to v3 window.MathJax = {...}.
- Enable $...$ / $$...$$ delimiters explicitly (v3 default is only
\(...\) and \[...\]).
- Add a pageReady shim that unwraps kramdown's <script type="math/tex">
tags into raw \(...\) / \[...\] before typesetting.
- Load tex-mml-chtml.js v3 bundle from jsdelivr (ships fonts inline).
Author
|
Live preview of this branch: https://aoboturov.github.io/notes/autoregressive/ (and other notes paths). Compare against the broken https://deepgenerativemodels.github.io/notes/autoregressive/ — the calligraphic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The site loaded MathJax from
//cdn.mathjax.org/..., retired in 2017, so all math on the rendered notes (e.g. the autoregressive page) was broken — symbols like\mathcal{D}showed up as tofu boxes.This PR migrates from MathJax v2 (dead CDN) to MathJax v3 on jsDelivr. v3 was chosen over a v2-on-jsDelivr swap because v2's HTML-CSS renderer was failing to load its calligraphic webfont in testing, and v3 ships fonts inline in a single bundle, which is more robust.
Changes
cdn.mathjax.orgscript tag withhttps://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js._layouts/post.htmlinto_includes/head.html, since v3 requireswindow.MathJax = {...}to be set before the loader runs.MathJax.Hub.Config({ TeX: { Macros: ... } })syntax to v3window.MathJax = { tex: { macros: ... } }. All custom macros (\Dc,\Exp,\KL,\note, etc.) are preserved.$...$/$$...$$delimiters — v3 defaults to only\(...\)/\[...\], but the source markdown uses$.startup.pageReadyshim that converts kramdown's legacy<script type="math/tex">...</script>wrappers into\(...\)/\[...\]before typesetting. v3 doesn't recognise the v2 script-tag protocol, and the built HTML indocs/already contains those wrappers.colorpackage so\textcolor{...}(used in the\notemacro) keeps working.docs/**/index.htmlfiles so the fix takes effect on GitHub Pages without a Jekyll rebuild (_config.ymlhasdestination: docs).Test plan
/notes/autoregressive/) —\mathcal{D},n,\mathbf{x}, display equations, and macros all render properly.cdn.mathjax.org has been retiredwarning and no MathJax errors.docs/under the/notesbaseurl and confirming math renders end-to-end.