Skip to content

Math Formulas

Controlled by features.math, rendered with KaTeX.

Enable

vue
<YanivEditor preset="full" />
<YanivEditor preset="notion" />
<YanivEditor preset="basic" :features="{ math: true }" />

The host must import KaTeX styles separately (peer dependency):

ts
import "katex/dist/katex.min.css";

Usage

  • full: insert LaTeX formulas from the header
  • notion: / → formula block
  • Supports inline and block-level formulas
  • Double-click a formula to edit its LaTeX source (a single click only selects the node); Ctrl/Cmd + Enter saves, Esc cancels

InputRule and Shortcuts

Typing $latex$ converts in place into an inline formula (find: /\$([^$]+)\$$/ matches the text before the cursor — the line does not have to be empty). Block formulas are inserted from the header, the / menu, or a shortcut.

ShortcutCommand
Ctrl/Cmd + MinsertInlineMath
Ctrl/Cmd + Shift + MinsertBlockMath

Lazy loaded

The math capability's extensions is async and MathExtension is loaded through a dynamic import(), so KaTeX-related code stays out of the initial chunk when features.math is off.