PHPackages                             linkrobins/toc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. linkrobins/toc

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

linkrobins/toc
==============

Auto-generated table of contents for Flarum posts. Builds anchors from Markdown headings (#, ##, ###) and renders an inline TOC at the top of each post that has 2+ headings.

v1.1.1(1w ago)017↓100%MITJavaScriptPHP ^8.3

Since May 20Pushed 1w agoCompare

[ Source](https://github.com/linkrobins/toc)[ Packagist](https://packagist.org/packages/linkrobins/toc)[ RSS](/packages/linkrobins-toc/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Link Robins Table of Contents
=============================

[](#link-robins-table-of-contents)

Auto-generated table of contents for Flarum posts. Builds anchors from Markdown headings (`#`, `##`, `###`) and renders an inline TOC at the top of each post that has two or more headings.

Works in two places out of the box:

- Forum discussion posts (anywhere a `.Post-body` is rendered)
- Link Robins Blog articles (`.LinkRobinsBlog-post-body`)

What it does
------------

[](#what-it-does)

For every heading in a post, the extension:

- Generates a stable, slugified id from the heading text
- Inserts an invisible scroll anchor above the heading, so clicking a TOC link lands the heading at a comfortable position rather than pinned to the viewport top
- Adds a click-to-copy affordance on the heading itself — clicking copies a deep link to the section

For each post with two or more headings, the extension prepends a compact "Contents" card listing every heading as a navigable link, indented by heading depth.

What it does NOT do
-------------------

[](#what-it-does-not-do)

- No BBCode for arbitrary anchors. Headings are anchors. If you want a heading-less anchor, add a heading.
- No floating bottom-right overlay TOC. The inline-at-top-of-post TOC covers the same UX with much less DOM fragility.
- No post-stream scroll synchronization or progress bars.

Installation
------------

[](#installation)

```
composer require linkrobins/toc
php flarum cache:clear
```

Enable from the admin extensions panel. No migrations.

Configuration
-------------

[](#configuration)

Two settings, both with sensible defaults:

SettingDefaultWhat`linkrobins-toc.max_depth``3`Highest heading level included in the TOC (`1`, `2`, or `3`)`linkrobins-toc.min_headings``2`TOC is hidden unless the post has at least this many headingsThese currently have no admin UI — set them via the Flarum settings API or directly in the `settings` table. An admin panel can be added later if needed.

How heading ids are generated
-----------------------------

[](#how-heading-ids-are-generated)

Within a single post, ids are stable and predictable:

- Heading text is lowercased, non-alphanumeric characters become dashes, repeating dashes collapse
- Empty headings get a `section` fallback
- Collisions inside the same post get `-2`, `-3`, suffixes
- Discussion posts prefix the id with the post number (e.g. `3-introduction`) so two posts on the same page don't fight over `#introduction`

The result is that linking to a section is just `#`. Hovering a heading shows a small link icon; clicking copies the URL.

License
-------

[](#license)

MIT.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance98

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

3

Last Release

10d ago

PHP version history (2 changes)v1.0.0PHP ^8.2

v1.1.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ba4ada28098b217152b5ec67bff43409a54b808d7d038119af6f56715a1c3f9?d=identicon)[linkrobins](/maintainers/linkrobins)

---

Top Contributors

[![linkrobins](https://avatars.githubusercontent.com/u/213107296?v=4)](https://github.com/linkrobins "linkrobins (4 commits)")

---

Tags

TOCtable-of-contentsflarumanchorsheadings

### Embed Badge

![Health badge](/badges/linkrobins-toc/health.svg)

```
[![Health](https://phpackages.com/badges/linkrobins-toc/health.svg)](https://phpackages.com/packages/linkrobins-toc)
```

###  Alternatives

[flarum-lang/russian

Russian language pack for Flarum.

12127.5k](/packages/flarum-lang-russian)[fof/byobu

Well integrated, advanced private discussions.

61112.4k10](/packages/fof-byobu)[caseyamcl/toc

Simple Table-of-Contents Generator for PHP. Generates TOCs based off H1...H6 tags

89359.5k5](/packages/caseyamcl-toc)[fof/gamification

Upvotes and downvotes for your Flarum community

4162.0k6](/packages/fof-gamification)[fof/polls

 A Flarum extension that adds polls to your discussions

25130.2k9](/packages/fof-polls)[fof/user-bio

Add a user bio to user profiles

21102.0k9](/packages/fof-user-bio)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
