# 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. ## Installation ```bash npx shadcn@latest add litingyes/blocove/markdown-math ``` > Typography requires [shadcn/typeset](https://ui.shadcn.com/docs/typeset). Copy `typeset.css` next to your main stylesheet, import it after Tailwind and add the `.typeset-docs` preset. This example also uses: `markdown`. ```bash npx shadcn@latest add litingyes/blocove/markdown ``` 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. ## Usage ### Import the KaTeX stylesheet ```ts // KaTeX ships the layout the formulas render into. import "katex/dist/katex.min.css" ``` ## API Reference ### 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` | - | ## Registry dependencies - `litingyes/blocove/markdown-parse` Namespace: `npx shadcn@latest add @blocove/markdown-math`