@jupyter-kit/mathjax-cdn
v3.0.0
Published
MathJax via CDN <script> injection for @jupyter-kit/core. Tiny plugin, MathJax loads in the browser.
Maintainers
Readme
@jupyter-kit/mathjax-cdn
MathJax loaded from a CDN at runtime. Tiny bundle (~1KB gz); the actual MathJax SVG renderer (~600KB) is fetched from jsdelivr the first time a math cell renders.
Install
pnpm add @jupyter-kit/mathjax-cdn @jupyter-kit/coreUsage
import { createMathjaxCdnPlugin } from '@jupyter-kit/mathjax-cdn';
createRenderer({
plugins: [createMathjaxCdnPlugin()],
});How it works
remark-mathtokenises$...$early so markdown escape processing can't mangle the LaTeX source.- A small rehype plugin re-wraps math nodes back into bare
$…$text so MathJax's auto-render finds them. - The CDN script (
mathjax@3/es5/tex-svg.js) is injected once intodocument.head; subsequent cells reuse it viaMathJax.typesetPromise.
Options
createMathjaxCdnPlugin({
src: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js', // default
config: { /* full window.MathJax config (overrides our defaults) */ },
forceReload: false,
});License
Apache-2.0. MathJax itself is Apache-2.0 and lives on the CDN; this package just orchestrates loading.
