John Smith105 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 | 1 | Shallowest eligible heading level. |
| Maximum heading depth | 6 | Deepest eligible heading level. |
| Automatically update managed TOCs | On | Refresh TOCs after heading edits. |
| Show managed TOC comments | Off | Keep start and end comments visible instead of revealing them only while editing the TOC. |
Generated entries always use standard Markdown section links such as [Example](#example). This is the documented same-page link syntax across GitLab 17, 18, and 19; unlike Obsidian WikiLinks, it cannot be reinterpreted as a GitLab wiki-page link. Existing managed TOCs are converted the next time they update.
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