v0.1.0
Initial release — published to npm as tanstack-markdown-math@0.1.0.
What's in the box
Math extensions for @tanstack/markdown with KaTeX rendering:
mathExtension(opts?)— block$$...$$+ inline$...$in one callmathBlockExtension()/mathInlineExtension()— available separately- Injectable renderer —
render(tex, displayMode)option, defaults tokatex.renderToString(throwOnError: false) - Strict by default — inline
$...$requires no adjacent spaces (avoids monetary false positives);allowSpaces: truefor permissive corpora - Streaming-friendly — unclosed
$$blocks render their partial content (safe to re-parse on every chunk) - Math inside paragraphs, headings, lists, tables, blockquotes and nested emphasis
Requirements
@tanstack/markdown>= 0.0.13 (peer)katex>= 0.16 (peer) — importkatex/dist/katex.min.cssin your appallowHtml: truein parser options (results are injected as HTML nodes)
Usage
import { mathExtension } from 'tanstack-markdown-math'
const options = {
allowHtml: true,
extensions: [...mathExtension()],
}MIT licensed. Dogfooded on a 900+ page medical corpus with dense math (17/17 formulas rendered on the reference chapter, 0 residue).