Math in Markdown
Math in Markdown is written in LaTeX notation between dollar signs: one $ on each side for a formula inside a sentence, and $$ on each side for an equation on its own line. Math is not part of CommonMark, but GitHub, Obsidian, VS Code's preview and Pandoc all support this syntax, and they render it with MathJax or KaTeX.
The energy is $E = mc^2$, where $c$ is the speed of light.
$$
\int_0^1 x^2 \, dx = \frac{1}{3}
$$
The first line renders the formula inline. The block renders as a centered equation.
What are the math delimiters?
| Syntax | Use | Supported by |
|---|---|---|
$...$ |
Inline formula | GitHub, Obsidian, VS Code preview, Pandoc |
$$...$$ |
Display equation | GitHub, Obsidian, VS Code preview, Pandoc |
$`...`$ |
Inline, safe from Markdown parsing | GitHub, Pandoc with GFM input |
A math code block |
Display equation | GitHub, Pandoc with GFM input |
GitHub's guide lists all four forms and says GitHub renders math with MathJax (GitHub Docs, checked November 2026). The backtick form is useful when a formula contains characters that Markdown would otherwise read, such as * or _:
$`a_1 * b_1 + a_2 * b_2`$
```math
\sum_{i=1}^{n} x_i
```
Which LaTeX commands do you need most?
| Write | Shows |
|---|---|
x^2, x^{10} |
Superscript; braces for more than one character |
x_i, x_{ij} |
Subscript |
\frac{a}{b} |
Fraction |
\sqrt{x}, \sqrt[3]{x} |
Square root, cube root |
\sum_{i=1}^{n}, \int_a^b |
Sum and integral with limits |
\alpha, \beta, \pi, \Delta |
Greek letters |
\le, \ge, \ne, \approx |
Comparisons |
\times, \cdot, \pm |
Operators |
\text{if } x > 0 |
Normal text inside math |
For several aligned lines, use an aligned environment inside a display block:
$$
\begin{aligned}
f(x) &= (x + 1)^2 \\
&= x^2 + 2x + 1
\end{aligned}
$$
How do you write a dollar sign that is not math?
Escape it with a backslash: \$. Pandoc also skips a $ followed by a space, and it does not treat a closing $ followed by a digit as math, so two prices on one line usually stay text there. When a line still renders as math by mistake, escape the dollar signs:
The plan costs \$X per month or \$Y per year.
GitHub's guide gives two rules: inside a math expression, write \$ for a literal dollar sign, and outside math on a line that also has math, wrap the literal dollar sign in <span> tags.
Why is my math not rendering?
- The app has no math support. CommonMark renderers show the dollar signs and LaTeX as typed.
- Spaces inside the delimiters.
$ x $is not math in Pandoc and some other renderers. Write$x$. - Markdown ate part of the formula. Underscores or asterisks between two
$signs can turn into italics first. Use the backtick form or amathblock. - Backslashes disappeared. A Markdown parser without math support treats
\,or\\as escapes and removes the backslash. - An unsupported command. MathJax and KaTeX cover most of standard LaTeX math, but not packages you would load in a full LaTeX document.
Where does Markdown math work?
| App or spec | Math |
|---|---|
| CommonMark | Not in the spec, shown as typed |
| GitHub | Yes, with MathJax |
| VS Code preview | Yes, built in with KaTeX |
| Obsidian | Yes, with MathJax |
| Pandoc | Yes, including equations in Word and PDF output |
| Noteline | Source in the editor; rendered in Word and PDF export |
Math in Noteline
Noteline's editor does not render math. It shows the LaTeX source as you typed it. In the desktop app, Word export turns $...$, $$...$$ and math blocks into native Word equations that you can edit in Word, and PDF export typesets them. HTML export and printing do not render math: they show the source text, and some backslashes are removed. If a note depends on formulas, export it to Word or PDF from the desktop app, or keep it where GitHub or Obsidian can render it.
Common questions
Should I use MathJax or KaTeX?
You usually do not choose: the app does. KaTeX is faster and covers fewer commands. MathJax covers more of LaTeX. Both read the same $ syntax for everyday formulas.
Can I number equations?
Not with Markdown syntax. Some renderers accept \tag{1} inside display math, but support varies, so check your app.
Does math work in Markdown tables?
Inline $...$ works inside GFM table cells on GitHub. A pipe inside the formula must be written as \|, because it would otherwise split the cell, or use the LaTeX command \vert instead.