Markdown Math
Math renderer for the markdown item, typeset with KaTeX. An expression that is still being written renders instead of throwing, and needs no math renderer registered, where the shell leaves the source literal.
Formulas are typeset with KaTeX: `$…$` renders inline and `$$…$$` as a display block that scrolls instead of overflowing the reading column. A formula that is still being written, or that has a syntax error, renders with KaTeX's error color instead of throwing, so streaming math never blanks the sentence. Without this renderer the shell leaves the dollar signs in the text.
Preview
Inline math typesets in the sentence, as in .
Display math gets its own line:
Installation
Add the item with the shadcn CLI, or copy the source manually.
pnpm dlx shadcn@latest add litingyes/blocove/markdown-mathRequires a shadcn/ui project set up with Base UI primitives. Blocove is developed against the b0 preset, but it installs no base config or theme tokens: your own preset, fonts and colors stay in place.
Or install from the namespace after adding the registry: npx shadcn@latest add @blocove/markdown-math
This example also uses: markdown
pnpm dlx shadcn@latest add litingyes/blocove/markdowntypeset.css next to your stylesheet, import it after Tailwind and add the .typeset-docs preset. See the Rich text editor setup.Usage
// KaTeX ships the layout the formulas render into.import "katex/dist/katex.min.css"API Reference
Props accepted by the exported components.
MarkdownMath
Renders one formula. The shell passes `value`, `display` and `streaming`; register it through the shell's `components` map. The item declares `katex` as its dependency and expects the KaTeX stylesheet to be imported once by the application.
Extends MarkdownMathProps.
| Prop | Type | Default |
|---|---|---|
value | string | Required |
display | boolean | Required |
streaming | boolean | - |
className | string | - |