Headings & TOC
Writing headings
Wrap a line in equal signs — the count sets the level (1–6):
= Section =
== Subsection ==Different from MediaWiki: top-level sections are written = Heading =.
MediaWiki convention avoids single = (it reserves that level for the page
title) and starts articles at == — here = is the normal first level, with
==, ===, … nested beneath it.
The rules the parser actually enforces:
- The heading must start at the beginning of the line — a leading space turns the line into preformatted text instead.
- The opening and closing runs must be the same length.
= a ==is an h1 whose text isa =, not a mistake the parser fixes. - Nothing but whitespace may follow the closing run —
== H == trailingrenders as an ordinary paragraph.
Headings are numbered automatically (1, 2, 2.1, …) and each section gets a pencil ✎ edit link when you’re logged in — it opens the editor on just that section.
Readers can click a heading to collapse its section — one of the reading niceties covered in Reading & appearance.
Anchors
Every heading gets a URL anchor derived from its text: spaces become _,
and almost everything else is kept as-is (only a handful of characters are
escaped). Link to one with a fragment:
[[Page Name#Section]]Duplicate headings get suffixes: the second == Alpha == on a page anchors
as Alpha_2, then Alpha_3, and so on.
The table of contents
Every page with at least one heading gets a table of contents. On wide screens it lives in the rail to the left of the article — headed by the page title, which jumps back to the top; on narrow screens it’s behind the floating ☰ button. The TOC is numbered the same way as the headings.
One magic word adjusts this:
__NOTOC__— hide the TOC on the page you write it on.
(__TOC__, which MediaWiki uses to force and position an inline TOC, is
accepted too — but since the TOC always appears and lives in the rail rather
than in the article body, it changes nothing. If a page contains both,
__TOC__ wins and the TOC stays.)