Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ADR-0006: GitHub Flavored Markdown without raw HTML

Status: Accepted (GFM); the exclusion of raw HTML is proposed
Date: 2026-11-21
Deciders: Format author

Context

"Markdown" is a family of dialects. Two readers must render the same chapter the same way, so the format has to name one dialect. The dialect also decides what a reader must contain: Markdown that permits HTML needs an HTML engine.

Decision

Chapters are CommonMark with the GitHub Flavored Markdown extensions (tables, task list items, strikethrough, extended autolinks) and GitHub-style footnotes. Raw HTML, network pictures and link schemes other than http, https and mailto are not allowed.

Options considered

DimensionA: GFM without raw HTMLB: CommonMark with heading attributesC: full GFM including HTML
Reader complexityMarkdown parser onlyMarkdown parser onlyMarkdown parser and an HTML engine
File sizeSameSameSame
CompatibilityRenders the same on GitHub and in GFM viewers{#id} shows as literal text on GitHubAccepts any GitHub document
EvolutionAdditions (math, alerts) degrade to textSameAnything can be smuggled in as HTML
SafetyNo active contentNo active contentScripts, styles and remote content must be filtered

Chosen: A.

Trade-off analysis

  • B was the first draft. It gives authors explicit anchor names, but in a syntax GitHub does not have, and it is a dialect nobody writes by default.
  • C accepts every existing document and brings the web engine that the format exists to avoid. It also reopens tracking and script injection.
  • A is a strict subset of what GitHub renders: every chapter is valid GFM, but not every GFM document is a valid chapter. Documents that use <br>, <sub> or <img width> must be converted when packed.

Two details follow from choosing GFM:

  • A single tilde now marks strikethrough, so packers escape literal tildes.
  • Extended autolinks have uneven library support. Of the two Rust parsers tried, markdown 1.0.0 implements the whole dialect and reports byte offsets; pulldown-cmark 0.13.5 does not turn bare URLs into links.

Consequences

  • Easier: authors use a dialect they know; books can be previewed on GitHub.
  • Easier: readers need no HTML, CSS or script handling.
  • Harder: layout that Markdown cannot express cannot be stored.
  • Harder: anchors are no longer chosen by the author (ADR-0007). Later, a name for a line that is not a heading was given back in plain GFM, as a link reference definition (ADR-0009).
  • To revisit: alert blocks; the exact CommonMark version; a formal definition of footnotes. Math did not become a part of the dialect: formulas are resources (ADR-0011).

Action items

  1. Packer: reject or convert raw HTML and disallowed schemes.
  2. Packer: escape literal tildes when importing prose.
  3. Build a conformance set of chapters and expected parse results.