Link Robins Table of Contents — Auto-Generated TOC for Posts and Articles
Hey everyone! Sharing another extension: Link Robins Table of Contents.
What it does
Scans the Markdown headings (#, ##, ###) in a post and renders a clean Contents box at the top of it — with clickable entries that smooth-scroll to each section, and shareable deep links to every heading. Perfect for forums where people write long guides, tutorials, or announcements.
Features
- Automatic Contents box — appears at the top of any post with 2+ headings; posts without enough headings stay untouched
- Smooth scrolling — clicking an entry scrolls to that section, correctly offset so your sticky header never covers the heading
- Shareable deep links — clicking a section heading copies a direct link to that section to the clipboard (with a "Link copied" toast) and updates the URL, so you can link someone straight to a section of a post
- Deep links just work on arrival — opening a shared
#section link scrolls to the right spot once the post has loaded
- Collision-proof anchors — anchors are prefixed per post, so two posts in the same discussion can both have an "Introduction" section without conflict
- Blog integration — also renders on Link Robins Blog articles, giving long-form articles a proper table of contents
- Theme-friendly & translatable — styled with Flarum 2's CSS custom properties; all visible strings go through the translator
- Zero configuration — install, enable, done
How it works
For readers:
- Open a post with 2+ headings — a Contents box sits at the top
- Click an entry to jump to that section
- Click a heading itself to copy a shareable link to it
For admins:
- Install and enable the extension
- There is no step 2 — every qualifying post gets a Contents box automatically
Installation
composer require linkrobins/toc
php flarum cache:clear
Then enable it in the admin panel.
Requirements
License
MIT.
Links
As always, feedback and bug reports are welcome — drop them here or open an issue on GitHub.