Overview
The MathBlock plugin provides standalone, display-mode math equations rendered with KaTeX. Unlike MathInline, which appears inline within text, MathBlock creates a dedicated block for larger equations that are centered and rendered in display mode. Both plugins are part of the@yoopta/math package, following the same pattern as Code / CodeGroup from @yoopta/code.
Installation
Basic Usage
Pass the plugin tocreateYooptaEditor (wrapped with withMath).
Features
- Display-mode equations rendered with KaTeX (centered, larger font)
- Standalone block — not inline within text
- Click to edit, with live KaTeX preview
- Copy LaTeX source to clipboard
- HTML, Markdown, and email serialization
- Dark mode support
Using with Themes
The@yoopta/themes-shadcn package includes a styled MathBlock component with a card-based edit UI.
- Preview mode — centered display-mode rendering with hover overlay (copy + edit buttons)
- Edit mode — larger textarea with live preview, save/cancel/delete actions
Element Props
Commands
Import commands:import { MathBlockCommands } from '@yoopta/math'
buildMathBlockElement
Creates a math block element structure without inserting it.
updateMathBlock
Updates the LaTeX expression of an existing math block.
getMathBlockElement
Finds the math-block element in a given block.
openEditor / closeEditor
Controls the edit state (requires withMath extension). Shared with MathInline.
Editor Extension
MathBlock shares the samewithMath extension as MathInline. See the MathInline docs for details.
Parsers
HTML
Serializes to<div data-math-block data-latex="..."> with KaTeX-rendered content inside (display mode).
Deserializes from <div data-math-block> elements, reading the data-latex attribute.
Markdown
Serializes to block math syntax:LaTeX Examples
Common display-mode expressions:Related Plugins
MathInline
Inline math expressions within text
Code
Code blocks (another void block plugin)

