KaTeX Support

Veröffentlicht: Lesedauer: 2 Min.

← Back to Table of Contents

9. KaTeX (Math)

mrkdwn renders mathematical formulas with KaTeX (version 0.19.1), fast and fully local.


Enable

Turn on Settings → Editor → KaTeX / Math.


Syntax

Tabelle 1
Type Syntax Example
Inline $ … $ $E = mc^2$
Block $$ … $$ see below

Block example:

$$
\int_0^\infty e^{-x}\,dx = 1
$$
  • In Visual mode, formulas render live.
  • In Raw mode, you see the raw KaTeX syntax.
KaTeX rendering

Rendered KaTeX formulas in the visual editor.


What is Supported? (Whitelist)

KaTeX supports a clearly defined set of commands — deliberately not the entire LaTeX language. This keeps rendering fast and safe. Supported includes:

  • Fractions & roots: \frac{a}{b}, \sqrt{x}, \sqrt[3]{x}
  • Exponents & subscripts: x^2, a_i, x_{i}^{2}
  • Greek letters: \alpha, \beta, \pi, \Sigma
  • Sums/integrals/limits: \sum, \int, \prod, \lim
  • Operators & relations: \times, \cdot, \leq, \geq, \neq, \approx
  • Arrows: \to, \rightarrow, \Rightarrow, \leftrightarrow
  • Sets & logic: \in, \subset, \cup, \cap, \forall, \exists
  • Matrices & environments: \begin{matrix}…\end{matrix}, pmatrix, bmatrix, cases, aligned
  • Accents: \hat{x}, \bar{x}, \vec{x}, \dot{x}
  • Fonts: \mathbb{R}, \mathcal{L}, \mathbf{x}, \text{…}
  • Auto-sized delimiters: \left( … \right), \left[ … \right]

Security/whitelist: Unsupported or potentially unsafe LaTeX macros (e.g. arbitrary \def/\newcommand with custom code, file access, external packages) are not executed. KaTeX renders only its vetted command set; unknown commands show an error hint instead of doing something “unexpected”. This keeps rendering deterministic and free of network/system access.

Full command list: see the official KaTeX overview of supported functions (Supported Functions / Support Table).


Examples

Inline: The solution is $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$.

Block:
$$
\begin{aligned}
f(x) &= (x+1)^2 \\
     &= x^2 + 2x + 1
\end{aligned}
$$

← Back · Next: Mermaid →

Letzte Anpassung: ↑ zum Anfang