WritedocsWritedocs

Math (LaTeX)

Wrap LaTeX in a single pair of dollar signs for inline math, or a double pair on their own lines for a standalone block equation - both render as real typeset math (via KaTeX) fully at build time, not as an image and not as a client-side widget.

The Pythagorean theorem states that $a^2 + b^2 = c^2$ in a right triangle.

$$
E = mc^2
$$

The Pythagorean theorem states that a2+b2=c2a^2 + b^2 = c^2 in a right triangle.

E=mc2E = mc^2

Since rendering happens at build time, there’s nothing to load client-side for math itself - no script, no flash of unstyled equations while a library initializes. The only thing every page picks up is one small, cached stylesheet for the typeset output’s own layout and glyphs.

A dollar sign is a delimiter, not just a character

A lone dollar sign with nothing to pair it with - a plain price mention, say - is left as ordinary text. But two or more dollar signs anywhere in the same paragraph can pair up and try to render as math even when none of them were meant to, including a dollar sign written inside inline code. When you need a literal dollar sign next to another one, back-slash escape it:

This plan costs \$50, that one costs \$80.

This plan costs $50, that one costs $80.

Keep a stray dollar sign’s own paragraph free of any other dollar sign, or escape it - this matters most on pricing pages, changelogs, or anywhere else dollar amounts show up more than once close together. Content inside a fenced ``` code block is always safe either way; math parsing never looks inside one.

Invalid LaTeX

A malformed equation doesn’t fail the build - it renders as a red inline error with the parser’s message in a tooltip, so one typo anywhere in a large docs site never blocks the rest of it from shipping. Refer to the LaTeX documentation for syntax questions.

Dark mode

Typeset math has no color of its own - it inherits whatever text color already surrounds it, so it follows the site’s light/dark toggle automatically with no extra configuration.