John Smith31 downloadsCreate a table of contents with GitLab-compatible heading links.
Create managed tables of contents whose Markdown links follow GitLab 17+ heading-anchor rules, including Unicode lowercasing, punctuation removal, and duplicate-heading suffixes.
This is a GitLab-focused fork of obsidian-plugin-toc by Andrew Lisowski.
Open the command palette and run one of these commands:
The editor right-click menu also offers both TOC creation actions. While the cursor is on a Markdown heading, it additionally offers Exclude heading from generated TOCs or Include heading in generated TOCs.
The plugin surrounds generated content with HTML comments:
<!-- toc-gitlab:start mode=full -->
- [Example](#example)
<!-- toc-gitlab:end -->
These comments do not render in Obsidian, GitLab, or ordinary Markdown viewers. Do not remove them if you want the TOC to update automatically. TOCs created by older versions are plain text and must be recreated once to become managed.
Multiple managed TOCs in one note are supported. Automatic updates are enabled by default and can be disabled in the plugin settings.
Add <!-- toc-ignore --> at the end of an ATX-style Markdown heading:
## Internal notes <!-- toc-ignore -->
The heading still renders normally and still receives its normal GitLab anchor, but it is omitted from every generated TOC. The marker can be added or removed through the command palette or editor right-click menu.
| Setting | Default | Purpose |
|---|---|---|
| List style | Bullet | Generate bullet or numbered lists. |
| Title | Empty | Optional content placed before each generated list. |
| Minimum heading depth | 2 | Shallowest eligible heading level. |
| Maximum heading depth | 6 | Deepest eligible heading level. |
| Use Markdown links | Off | Generate Markdown links instead of WikiLinks. |
| GitLab-compatible Markdown section links | Off | Apply GitLab heading-anchor rules. |
| Automatically update managed TOCs | On | Refresh TOCs after heading edits. |
For portable GitLab documents, enable Use Markdown links and GitLab-compatible Markdown section links. The plugin intercepts Obsidian's native link router at runtime, maps GitLab fragments to their real headings, and uses temporary in-memory block targets for exact navigation—including duplicate headings. The raw Markdown remains GitLab-compatible and no compatibility plugin is required.
Install from the Obsidian community plugin browser when available, or download the latest release and place main.js and manifest.json in:
<vault>/.obsidian/plugins/toc-gitlab/
Then reload Obsidian and enable Table of Contents for GitLab under Community plugins.
npm ci
npm test
npm run build
npm run lint