Skip to content

v0.1.0

Choose a tag to compare

@bertrandgressier bertrandgressier released this 11 Sep 14:06
· 19 commits to main since this release
cf4560b

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 call
  • mathBlockExtension() / mathInlineExtension() — available separately
  • Injectable renderer — render(tex, displayMode) option, defaults to katex.renderToString (throwOnError: false)
  • Strict by default — inline $...$ requires no adjacent spaces (avoids monetary false positives); allowSpaces: true for 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) — import katex/dist/katex.min.css in your app
  • allowHtml: true in 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).