Skip to content

Conversation

@thostetler
Copy link
Member

@thostetler thostetler commented Feb 10, 2026

Fixes NECTAR-13D

MathJax CHTML output auto-detects font URLs by inspecting its own
script tag location. When loaded dynamically via better-react-mathjax,
this detection can fail, causing the browser to construct incorrect
font URLs that get blocked by the CSP font-src
directive.

  • Set explicit chtml.fontURL in MathJax config tied to each CDN source
  • Removed unpkg.com fallback

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.6%. Comparing base (908d3ec) to head (a6d00c6).

Files with missing lines Patch % Lines
src/mathjax.ts 86.4% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #796     +/-   ##
========================================
- Coverage    61.6%   61.6%   -0.0%     
========================================
  Files         312     312             
  Lines       35995   36000      +5     
  Branches     1593    1593             
========================================
  Hits        22141   22141             
- Misses      13817   13822      +5     
  Partials       37      37             
Files with missing lines Coverage Δ
src/mathjax.ts 65.0% <86.4%> (+4.0%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…violations

MathJax CHTML output auto-detects font URLs from its script location,
but this fails for dynamically injected scripts, causing blocked font
requests. Setting chtml.fontURL explicitly ensures fonts load from the
correct CDN path regardless of how MathJax is bootstrapped.

Also removes the unpkg.com fallback CDN which was never allowed by the
CSP and would silently fail.
@thostetler thostetler marked this pull request as ready for review February 10, 2026 15:46
@thostetler thostetler force-pushed the NECTAR-13D-fix-csp-font-blocking branch from 75e1d17 to a6d00c6 Compare February 10, 2026 15:46
@thostetler thostetler merged commit dfd7dc3 into adsabs:master Feb 10, 2026
5 checks passed
@thostetler thostetler deleted the NECTAR-13D-fix-csp-font-blocking branch February 10, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants