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
A list of links to heading IDs. Works everywhere links do.Works everywhere- [Install](#install) - [Configure](#configure)
Python-Markdown, Typora ([toc]) and some wikis.Some tools only[TOC]
Example
You type
## Contents
- [Install](#install)
- [Configure](#configure)
- [Space permissions](#space-permissions)
- [Known issues](#known-issues)You get
Contents
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.