Markdown TOC Generator

Generate a table of contents from Markdown headings with GitHub-style anchor links

Key Facts

Category
Conversion & Encoding
Input Types
textarea, select, checkbox
Output Type
text
Sample Coverage
4
API Ready
Yes

Overview

The Markdown TOC Generator automatically creates a structured table of contents from your Markdown headings. It generates GitHub-style anchor links, allowing readers to navigate long documents, READMEs, or wiki pages with ease.

When to Use

  • When writing long-form documentation or README files that need a clear navigation structure.
  • When you want to automatically generate GitHub-compatible anchor links for your Markdown headings.
  • When formatting wiki pages or technical blogs where readers benefit from a quick overview of the content outline.

How It Works

  • Paste your raw Markdown text into the input area.
  • Configure your preferences, such as the minimum and maximum heading levels (H1 to H6), list style, and indentation.
  • Choose whether to include anchor links and select your desired output format (Markdown, HTML, or both).
  • Copy the generated table of contents directly into your document.

Use Cases

Generating a table of contents for a project README.md file on GitHub.
Creating structured navigation outlines for technical documentation and user guides.
Formatting blog posts written in Markdown to improve readability and SEO structure.

Examples

1. GitHub README Navigation

Open Source Developer
Background
A developer is publishing a new open-source library and has written a comprehensive README.md file with multiple sections.
Problem
The README is very long, making it difficult for users to find installation instructions and API references quickly.
How to Use
Paste the README content into the input, set the minimum heading level to H2, select 'Unordered' list style, and enable 'Include Anchor Links'.
Example Config
minLevel: 2, maxLevel: 6, listStyle: unordered, indent: 2spaces, includeAnchor: true, outputFormat: markdown
Outcome
A clean, clickable Markdown list of H2-H6 headings with GitHub-compatible anchor links ready to paste at the top of the README.

2. Technical Documentation Outline

Technical Writer
Background
A technical writer is drafting a software user manual in Markdown and needs an HTML-formatted table of contents for a web portal.
Problem
The manual needs a structured, nested HTML list of headings from H1 to H3 to embed directly into a web template.
How to Use
Paste the manual text, set the maximum heading level to H3, select 'HTML' as the output format, and choose '4 Spaces' for indentation.
Example Config
minLevel: 1, maxLevel: 3, listStyle: unordered, indent: 4spaces, includeAnchor: true, outputFormat: html
Outcome
An HTML-formatted nested list containing anchor links pointing to the document's H1, H2, and H3 headings.

Try with Samples

markdown, barcode

Related Hubs

FAQ

How does the generator create anchor links?

It formats heading text into GitHub-style slugs, converting characters to lowercase and replacing spaces with hyphens.

Can I limit the table of contents to specific heading levels?

Yes, you can set the minimum and maximum heading levels (from H1 to H6) to filter out minor subheadings.

What list styles are supported?

You can choose between unordered lists (using hyphens) and ordered lists (using numbers).

Does this tool support HTML output?

Yes, you can output the table of contents as Markdown, HTML, or a combination of both.

Can I indent the list items with tabs instead of spaces?

Yes, the tool supports indentation using 2 spaces, 4 spaces, or tab characters.

API Documentation

Request Endpoint

POST /en/api/tools/markdown-toc-generator

Request Parameters

Parameter Name Type Required Description
markdownInput textarea Yes -
minLevel select No -
maxLevel select No -
listStyle select No -
indent select No -
includeAnchor checkbox No -
outputFormat select No -
wrapCodeBlock checkbox No -

Response Format

{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}
Text: Text

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-markdown-toc-generator": {
      "name": "markdown-toc-generator",
      "description": "Generate a table of contents from Markdown headings with GitHub-style anchor links",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=markdown-toc-generator",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]