@jupyter-kit/katex-cdn
v3.0.0
Published
KaTeX via CDN loader for @jupyter-kit/core. Tiny bundle; KaTeX auto-render runs in the browser.
Maintainers
Readme
@jupyter-kit/katex-cdn
KaTeX loaded from a CDN at runtime. Tiny bundle (~1KB gz); KaTeX core (~88KB) plus its stylesheet is fetched from jsdelivr on first use.
Install
pnpm add @jupyter-kit/katex-cdn @jupyter-kit/coreUsage
import { createKatexCdnPlugin } from '@jupyter-kit/katex-cdn';
createRenderer({
plugins: [createKatexCdnPlugin()],
});The plugin injects katex.min.css, katex.min.js, and
contrib/auto-render.min.js into document.head on first use, then calls
renderMathInElement for every markdown cell.
How it works
remark-mathtokenises$...$early so markdown escapes survive.- A small rehype plugin re-emits
$…$/$$…$$text so KaTeX auto-render finds the delimiters.
Options
createKatexCdnPlugin({
version: '0.16.22', // CDN version pin
baseUrl: 'https://cdn.jsdelivr.net/npm/[email protected]/dist',
delimiters: [...], // override default $ / $$ / \( / \[
rendererOptions: { /* renderMathInElement opts */ },
});License
Apache-2.0. KaTeX itself is MIT and served from the CDN.
