Skip to content
All Markdown syntax

Table of contents in Markdown

Links and images

Markdown syntax

Works everywhere
- [Install](#install)
- [Configure](#configure)

A list of links to heading IDs. Works everywhere links do.

CommonMark has no TOC syntax. The portable version is a list of links to each heading's ID. GitHub shows an outline menu for every Markdown file, and many editors and static site generators can insert one for you.

All ways to write it

  • - [Install](#install)
    - [Configure](#configure)
    A list of links to heading IDs. Works everywhere links do.Works everywhere
  • [TOC]
    Python-Markdown, Typora ([toc]) and some wikis.Some tools only

Example

You type

## Contents

- [Install](#install)
- [Configure](#configure)
  - [Space permissions](#space-permissions)
- [Known issues](#known-issues)

Questions

Does GitHub support [TOC]?

No. GitHub has an outline button on every rendered Markdown file instead. For a TOC inside the file, write the list of links.

Can a VS Code extension generate it?

Yes. Extensions such as Markdown All in One create and update a linked TOC from your headings.

Table of contents in Confluence

Confluence has a Table of contents macro that builds itself from the page's headings, and pages imported with Markdown Importer keep their headings, so the macro works on them. Markdown Exporter includes the Table of contents macro when it exports a page.

Related syntax

Also in Links and images

See all Markdown syntax