Markdown Math Syntax: Fences, Blocks and Renderers

Markdown has no maths syntax of its own. What it has is a convention — carry LaTeX through a fence — and several renderers that implement that…

Markdown has no maths syntax of its own. What it has is a convention — carry LaTeX through a fence — and several renderers that implement that convention slightly differently.

The two forms everyone agrees on

  • Inline: $E=mc^2$.
  • Display: $$E=mc^2$$ on its own lines.

Some tools also accept \( ... \) and \[ ... \], and some accept a fenced ```math block. If your document has to survive several pipelines, stick to the dollar forms.

Where renderers differ

GitHub supports $...$ in issue bodies and Markdown files, but a lone $ inside a table cell can be swallowed by the table parser. Obsidian treats $$ blocks as their own paragraph. Jupyter accepts both and renders with MathJax. Static site generators depend on which plugin you wire up — markdown-it-katex and remark-math behave differently on blank lines inside a fence.

The escaping trap

Anything inside a code span or fenced code block is literal: a dollar sign there will never become maths. That is usually what you want, but it means a tutorial that shows $$...$$ inside a code fence must not also expect it to render.

markdownmathkatex