Last updated
Markdown TOC Generator Examples
The Markdown TOC Generator creates a table of contents from your document's heading structure. Below are examples of input headings and the TOC output produced.
Simple Document TOC
Input headings:
# Getting Started
## Installation
## Configuration
## Usage
# API Reference
## Authentication
## Endpoints
## Error Codes
# Contributing
# License
Generated TOC:
## Table of Contents
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [API Reference](#api-reference)
- [Authentication](#authentication)
- [Endpoints](#endpoints)
- [Error Codes](#error-codes)
- [Contributing](#contributing)
- [License](#license)
Deep Nesting (H1–H4)
Input:
# Introduction
## Background
### History
#### Early Development
### Current State
## Goals
Generated TOC:
- [Introduction](#introduction)
- [Background](#background)
- [History](#history)
- [Early Development](#early-development)
- [Current State](#current-state)
- [Goals](#goals)
Duplicate Heading Handling
Input (two sections with the same name):
# Installation
## macOS
### Prerequisites
## Windows
### Prerequisites
## Linux
### Prerequisites
Generated TOC (with deduplication):
- [Installation](#installation)
- [macOS](#macos)
- [Prerequisites](#prerequisites)
- [Windows](#windows)
- [Prerequisites](#prerequisites-1)
- [Linux](#linux)
- [Prerequisites](#prerequisites-2)
Headings with Special Characters
Input:
## What is `async/await`?
## Using the `--verbose` Flag
## C++ Integration
## FAQ & Troubleshooting
Generated TOC:
- [What is `async/await`?](#what-is-asyncawait)
- [Using the `--verbose` Flag](#using-the---verbose-flag)
- [C++ Integration](#c-integration)
- [FAQ & Troubleshooting](#faq--troubleshooting)
H2-Only TOC (Filtered)
For long documents, include only H2 headings to keep the TOC concise:
## Table of Contents
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [API Reference](#api-reference)
- [Contributing](#contributing)
Numbered TOC Style
## Table of Contents
1. [Getting Started](#getting-started)
1. [Installation](#installation)
2. [Configuration](#configuration)
2. [API Reference](#api-reference)
1. [Authentication](#authentication)
2. [Endpoints](#endpoints)
3. [Contributing](#contributing)
README File Example
Paste this at the top of your README after the title and description:
# My Project
A brief description of what this project does.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [API Reference](#api-reference)
- [Contributing](#contributing)
- [License](#license)
## Installation
...rest of README...
Anchor ID Rules
- Heading text is converted to lowercase
- Spaces are replaced with hyphens
- Special characters (punctuation, symbols) are removed
- Backtick code spans have backticks removed
- Duplicate headings get -1, -2, -3 suffixes
- Leading and trailing hyphens are removed
Common Use Cases
- Adding navigation to long README files on GitHub
- Creating TOC for technical documentation and guides
- Generating navigation for wiki pages and knowledge bases
- Updating TOC after adding or reorganizing document sections
- Planning document structure by visualizing heading hierarchy
Paste your Markdown document to instantly generate a properly formatted TOC with correct anchor links. Choose heading depth, numbering style, and TOC title to match your document's needs.