Skip to content

Offline math rendering broken since MathJax v4 upgrade: font chunks are fetched from CDN at typeset time, stalling the entire typesetting queue #6617

Description

@ladcash

Issue title

Offline math rendering broken since MathJax v4 upgrade: font chunks are fetched from CDN at typeset time, stalling the entire typesetting queue

Issue body

Version: 1.14.9 (7785), macOS Tahoe 26.6
Regression: worked fully offline in ≤ 1.12.x (MathJax v3); broken since the MathJax v4 upgrade in 1.13.

Summary

Since the MathJax v4 upgrade, Typora no longer bundles (or does not use) the complete MathJax font set. MathJax v4 lazy-loads font chunks on demand, and Typora fetches them from cdn.jsdelivr.net (with loli.net as a mirror) at typeset time — confirmed by observing Typora's outbound connections with Little Snitch. With no network connection, the first equation requiring a non-base font chunk (e.g. the double-struck chunk for \mathbb) stalls, and because MathJax typesets sequentially, every subsequent equation in the document is left as raw LaTeX source — including trivial ones that need no extra fonts. When the network returns, the pending fetch completes and the whole document snaps to rendered form.

For an editor whose core promise includes working offline, math documents being unrenderable offline is a significant regression. It also means every math-heavy document silently depends on third-party CDNs being reachable.

Steps to reproduce

  1. Quit Typora, disconnect from the network (or block Typora's outbound connections with a firewall), and relaunch Typora in a fresh session, so no font chunks are cached in memory.
  2. Open a new document and paste:
    $\omega^k$ and $\pm h$ then $\mathbb{Z}[\omega]^3$ then $\sigma$
    
    (Inline math enabled in Preferences → Markdown.)

Expected

All four expressions render, as they did in Typora ≤ 1.12.x.

Actual

$\omega^k$ and $\pm h$ render (base font). $\mathbb{Z}[\omega]^3$ — the first expression needing a dynamically-loaded font chunk — and everything after it, including the trivial $\sigma$, remain as raw LaTeX source. Reconnecting the network causes the document to fully render within a few seconds with no user action.

Diagnosis

  • Little Snitch shows Typora connecting to jsdelivr.net and loli.net during typesetting; blocking these domains reproduces the offline failure exactly even while the machine is online.
  • MathJax v4's default fontPath points to cdn.jsdelivr.net/npm/@mathjax; it appears Typora ships only the base font data and leaves dynamic font loading pointed at the CDN.
  • The stall-then-flush behavior matches MathJax's sequential typesetting queue blocking on the pending font fetch.

Suggested fix

Bundle the complete font data for the default font with the app (as was effectively the case with MathJax v3) or set the v4 fontPath/dynamic-load paths to app-local resources, so no network access is required to typeset any supported TeX input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions