cms-alchemy/toc-inline

Adds a [toc] token that generates a table of contents from headings in Drupal content.

Maintainers

Package info

github.com/DanielMoody/toc_inline

Type:drupal-module

pkg:composer/cms-alchemy/toc-inline

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-03-30 01:03 UTC

This package is auto-updated.

Last update: 2026-05-01 00:22:16 UTC


README

Adds a [toc] token that generates a table of contents from headings (<h1><h6>) in the content.

Overview

ToC Inline is a lightweight Drupal filter plugin that scans rendered HTML for headings and replaces a [toc] token with a structured table of contents and is enabled automatically by the install script for Basic Html and Full HTML.

It is designed for editorial convenience—drop a token, get a working ToC with anchor links. No blocks, no Views, no extra configuration overhead.

Installation

composer require cms-alchemy/toc-inline-finder
drush en toc_inline

Features

  • Uses [toc] token anywhere in content
  • Automatically scans <h1><h6> tags
  • Generates unique IDs for headings when missing
  • Deduplicates existing IDs safely
  • Builds nested lists based on heading levels
  • Outputs accessible markup (<nav aria-label="Table of contents">)
  • No JavaScript required (server-side rendering)