Glenn R. Martin62 downloadsType a Typora-style [TOC] tag — or your own regex patterns, even a code-fence marker — anywhere in a note to render a live table of contents built from its headings. Choose to show it as links or hide it in Live Preview. Insert it via the command palette or right-click menu, and it stays in sync as headings change, with real links in Reading View.
An Obsidian plugin that adds Typora-like [TOC] tag support for rendering an inline table of contents.
Drop a [TOC] tag into a note and it renders as a live table of contents built from the note's headings — the same shorthand Typora users are used to.
Functional. Bootstrapped from the official Obsidian sample plugin; not yet published to the community plugin directory.
[TOC] tag detection — matches the literal [TOC] tag by default, plus any number of your own regular expressions (Settings → TOC patterns), so alternate conventions can be recognized too.[TOC], but can be set to anything, including multi-line text like a fenced ```toc code block.#id-anchor links to each heading (duplicate heading names get disambiguated with -1, -2, etc., same as Obsidian's own convention).Links (a real, built-out table of contents) or Hide (nothing).[TOC].^\[TOC\]$ pattern.Links aren't clickable in exported PDFs. In "Links" display mode, the table of contents renders as real clickable links in Live Preview and Reading View. In a PDF exported from Obsidian, those same links render but aren't clickable — this is a limitation of Obsidian's PDF exporter, not this plugin.
Obsidian's PDF export goes through Electron's printToPDF, which is Chromium's print pipeline. That pipeline doesn't convert same-document href="#id" fragment anchors into real PDF navigation links, regardless of how the underlying HTML is built — external http(s):// links survive export as clickable, but same-note anchor links don't. This is tracked upstream as a Chromium bug and has been a standing Obsidian feature request for years with no fix in Obsidian core.
The only known workaround (obsidian-pdf-anchors) rewrites the already-exported PDF file's internal link destinations after the fact — a fundamentally different (and much larger) kind of engineering than rendering markdown, and out of scope here for now.
node --version)npm i to install dependenciesnpm run dev to compile src/main.ts → main.js in watch modenpm run build to type-check and produce a production buildnpm run lint to run ESLint (including Obsidian-specific rules)Copy (or symlink) main.js, styles.css, and manifest.json into VaultFolder/.obsidian/plugins/toc-block/, then enable the plugin under Settings → Community plugins in Obsidian.
npm version patch|minor|major (updates manifest.json, package.json, and versions.json together), or update manifest.json/versions.json manually.v prefix). The release workflow builds the plugin and creates a draft GitHub release with main.js, manifest.json, and styles.css attached automatically.