md2 syntax
Standard Markdown plus tables, math, footnotes, a cover page and page breaks.
Basics
md2 reads CommonMark with the GFM extensions: tables, task lists, strikethrough, autolinks and footnotes.
# A heading
Some **bold**, `code` and ~~struck~~ text.
- [x] A finished task
- [ ] An upcoming taskFront matter and cover
A YAML block at the top fills in the document metadata. When title is present, PDFs get a cover page automatically (turn it off with the cover: false option).
---
title: Q3 report
author: Finance team
subject: Financial results
keywords: [report, quarterly]
date: 2026-10-01
---Math
KaTeX formulas inline between $…$, and as a block between $$…$$:
Code
Name the language after the opening fence to get highlighting. The engine knows the 37 common languages plus a few extras. Code always stays left-to-right, even inside an Arabic document.
print("Hello")Direction
The default is auto: md2 detects the document language from the share of Arabic letters, then sets the direction of each paragraph on its own. An English paragraph inside an Arabic document runs left-to-right without you doing anything.
Page breaks
To start a new page in a PDF, use a small HTML tag:
<div style="page-break-after: always"></div>Raw HTML
A limited amount of HTML is allowed inside Markdown, and it is always sanitised: no scripts, no event handlers, no frames.