Markdown TOC Generator (Auto from Headings)

Auto-generate a Tafla of Contents from Markdown headings. Select heading levels (like H2-H4), then copy editafla úttak and paste it immediately.

Supports H2-only, anchor modes, and duplicate headings without extra setup.

Your text stays local in the browser and is never uploaded.

How to use (30 sec)

  1. Paste your Markdown text.
  2. Choose heading levels (H2-only / H2-H4, etc.).
  3. Copy the generated TOC and paste it into your document.

Inntak and úttak example

Example with duplicate headings

Inntak

# Document Title
## Overview
## Usage
### Install
### Settings
## FAQ
## FAQ

Úttak (H2-H3 / bullet list / TOC heading ON)

## Tafla of contents

- [Overview](#overview)
- [Usage](#usage)
  - [Install](#install)
  - [Settings](#settings)
- [FAQ](#faq)
- [FAQ](#faq-2)

Specification (anchor and duplicate rules)

Heading extraction rules

  • Extracts ATX headings (# to ####) in the selected range.
  • Ignores lines inside fenced code blocks (``` ... ```).
  • Use level filter (H2 only / H2-H3 / H2-H4 / H1-H4).
  • Setext headings (=== / ---) are not included in the first version.

Anchor generation rules (verkfæri rule)

  1. Trim heading text.
  2. Lowercase alphabetic letters.
  3. Convert spaces to '-'.
  4. Remove symbols except '-'.
  5. Collapse repeated '--' into '-'.
  6. Trim leading and trailing '-'.
  7. Append -2, -3 ... when duplicate anchors occur.

TOC link behavior may differ by hosting platform and Markdown viewer. Edit úttak as needed.

Algengar spurningar

Can I generate H2-only TOC?

Yes. Choose "H2 only" in Heading levels.

How is anchor text decided?

Anchors follow the rule described in this page. You can also choose "Custom" or edit úttak manually.

How are duplicate headings handled?

Duplicate headings get suffixes such as -2, -3 to keep anchors unique.

Can I exclude specific headings from TOC?

Yes. Use Exclude keywords in Advanced settings.

Can I generate TOC without links?

Yes. Select anchor mode "No anchors".

Athugasemdir

  • Anchor behavior varies by Markdown environment.
  • Úttak is editafla so you can fine-tune for your renderer.
  • Inntak text is processed locally in your browser.