Plugin documentation · v1.2.0

TOCflow

A server-rendered Table of Contents for the WordPress block editor — and the only TOC plugin with a built-in Reading Guide. Slug: tocflow.

1. Install

From WordPress.org — go to Plugins → Add New, search for tocflow, click Install Now.

From a ZIP — download tocflow.zip from GitHub Releases, then Plugins → Add New → Upload Plugin.

Developers — clone into wp-content/plugins/tocflow and run:

npm install
npm run build

Source files are in src/. Compiled assets land in build/. Run npm run start for watch mode.

2. Quick start

  1. Edit a post that has Heading blocks (H2–H6 appear by default; H1 is off).
  2. Click + and search for Table of Contents. Insert it anywhere — typically after the intro paragraph.
  3. The editor shows a live outline. Rearrange your headings and watch it update.
  4. To enable sitewide auto-insert, open Settings → TOCflow in wp-admin.

3. Block sidebar

Every block instance is configured through the block sidebar in the editor.

Panel / controlWhat it does
Title — text, show/hide, HTML tagEditable on the canvas via RichText. Tag: P (default), H2, H3, or H4.
H1–H6 togglesWhich heading levels appear in this block's outline.
Numbered list (toolbar)Switches between <ul> and <ol>.
Numbering styleSequential (1, 2, 3) or Nested (1, 1.1, 1.1.1).
Hide markersRemoves bullets and browser-generated numbers while preserving structure.
Style presetStyles panel: Default · Minimal · Boxed · Underline · Card.
Two columnsDisplays the outline in two columns; collapses to one on small screens.
Compact spacingTighter line height for shorter lists.
Underline linksAlways underline TOC links (vs. underline-on-hover).
Max heightAdds a scrollable container when the list exceeds N pixels.
StickyKeeps the block fixed during scroll using position: sticky.
Collapsible / start collapsedAdds a toggle button. Start collapsed defaults the block closed.
Highlight active headingScroll-spy marks the section currently in view with aria-current.
Smooth scrollPer-block override: Inherit site default · On · Off.
Scroll offset overridePixels to leave above a sticky header. −1 inherits the site-wide offset.
Minimum headingsHide this block when the post has fewer matching headings.

4. Style presets

Switch presets from the Styles panel (the paintbrush icon in the toolbar). Each preset is a Gutenberg Block Style (is-style-{name}) so it works with theme.json color palettes and FSE style overrides.

PresetDescription
DefaultClean list with a subtle left border accent.
MinimalNo border, no background, plain links.
BoxedContained in a card with background fill and border.
UnderlineLinks always underlined; minimal chrome.
CardElevated card with shadow and accent border.

All presets inherit the theme's foreground and link colors via CSS custom properties.

5. Skip a heading

Add CSS class no-toc or tocflow-skip to a Heading block under Advanced → Additional CSS class(es). That heading is excluded from both the TOC list and the anchor injection.

6. Reading Guide 1.1+

Reading Guide mode transforms the TOC from a navigation list into an intelligent reading companion. Enable it in the block sidebar under Reading Guide.

All features are opt-in. Disabling everything gives you a standard, fast, server-rendered TOC identical to v1.0. Enable features individually as needed.

Hover section preview

A floating tooltip showing the section's opening text appears when a reader hovers over (or focuses) a TOC link. The reader sees section content without scrolling.

Full Reading Guide features

Enable with Reading Guide → Full Reading Guide. Each sub-feature can be toggled independently.

FeatureHow it works
Section content previewsAlways-visible opening ~20 words beneath each TOC link. Extracted server-side from block content; container blocks (Group, Columns, Cover) are handled without double-counting.
Section length barsThin bar showing word count as a proportion of the longest section. Rendered as a CSS custom property (--tocflow-density) set per item at PHP render time.
Read-time estimates~N min badge. Calculated as ceil(words / 200) at render time. Minimum 1 min.
Reading progressIntersectionObserver fades TOC items as the reader scrolls each heading past the top of the viewport. No timers; pure intersection tracking.

Section Planner (author → reader) 1.2

Writers type a short teaser or hook per heading in the Section Planner sidebar panel and can mark each heading as ✏️ Draft, 🔄 In progress, or ✅ Done. Status is stored in the sectionStatus block attribute; teasers stay in sectionNotes (objects keyed by heading slug).

On the front end, each section with a note shows a small ✍ button. The reader taps it to reveal the note. No database round-trip — the note is in the block markup.

Notes are per-block-instance. If you have two TOC blocks in a post, each stores its own notes independently.

Study assistant New in 1.2

These reader tools are opt-in. They store state in the browser only — no accounts, no server calls.

FeatureHow it works
Reader note padsA 📝 button per section opens a private pad stored in localStorage. Toggle: Reader note pads or shortcode rnotes="1".
Reading progress barA thin 0–100% bar tracks headings scrolled past via IntersectionObserver. Toggle or rprogress="1".
Resume bookmarkRemembers the last-read heading and shows a ↩ Resume button on return visits. Toggle or bookmark="1".
Total read-time badgeWhen Reading Guide + read-time are on, the TOC header shows the aggregated read time for the post.

Per-section academic citations New in 1.1

A § button on each TOC item copies a formatted academic citation for that section — including the direct #anchor URL.

Supported formats: APA, MLA, Chicago, Harvard, Plain link. Choose the default in Reading Guide → Citation format.

All citation data comes from WordPress: get_the_author_meta('display_name'), get_the_title(), get_bloginfo('name'), get_the_date('Y-m-d'), get_permalink(). Zero external API calls.

Example APA output:

Smith, J. (2026, September 8). Section Title. In Post Title. Site Name. https://example.com/post/#section-slug

Emoji reactions (reader → writer)

Readers react to individual sections with four emoji: 💡 Insightful · ⭐ Saved · 🤔 Unclear · ✅ Got it.

7. Settings → TOCflow

Find these under WordPress admin → Settings → TOCflow.

Reading experience

SettingDefaultNotes
Smooth scrollOnAnimates anchor jumps. Automatically skipped for users who prefer reduced motion.
Scroll offset (px)0Pixels of space to leave under a sticky admin bar or theme header. Typical values: 32 (admin bar) + header height.
Highlight active headingOnSite-wide default. Overridable per block.
Minimum headings2Hides the TOC when a post has fewer matching headings. Overridable per block.

Auto-generate the block

SettingNotes
Position: Off / Top of content / After first headingPosts already containing the block or [tocflow] shortcode are skipped.
Post typesCheckboxes for all registered public post types.
Title text and show/hideDefault title for the auto-generated block.
Title elementP, H2, H3, or H4.
Heading levels H1–H6H1 off by default.
List type and numberingBullets, sequential, or nested.
Style presetDefault, Minimal, Boxed, Underline, Card.
Layout optionsCompact, two columns, underline links, max height.
BehaviorSticky, collapsible, start collapsed.

SEO & data

SettingDefaultNotes
Schema markup (JSON-LD)OffOutputs an ItemList structured data block for the outline. Leave off if Yoast SEO, Rank Math, or Schema Pro is already outputting a TOC schema.
Delete data on uninstallOffRemoves plugin options when the plugin is deleted. Deactivating never deletes data.

8. Shortcode

Use [tocflow] in Classic Editor content, text widgets, or theme templates via do_shortcode('[tocflow]').

All block attributes are available as shortcode attributes (snake_case or camelCase):

[tocflow title="Contents" ordered="1" numbering="nested" style="boxed" h4="1" min="3"]
AttributeValuesDefault
titleAny stringTable of Contents
showtitle0 / 11
titletagp, h2, h3, h4p
h1h60 / 1h2=1, h3=1, others=0
ordered0 / 10
numberingdefault / nesteddefault
markers0 / 1 (1 = show)1
collapsible0 / 10
collapsed0 / 10
sticky0 / 10
compact0 / 10
columns1 / 21
underline0 / 10
highlight0 / 1site default
maxheightpixels (0 = unlimited)0
minintegersite default
smoothinherit / on / offinherit
styledefault, minimal, boxed, underline, carddefault
rprogress0 / 10
bookmark0 / 10
rnotes0 / 10

9. Compatibility

Compatibility is a core design principle of TOCflow. The block inherits theme colors and fonts, never loads from third-party CDNs, and makes zero remote calls in any mode.

SEO plugins

Yoast SEO Rank Math All in One SEO Schema Pro SEOPress

TOCflow's JSON-LD schema is off by default and outputs only when you enable it. If your SEO plugin already generates a TOC schema, leave TOCflow's off to avoid duplicate structured data. The block navigation landmark itself is invisible to SEO plugins.

Yoast & Rank Math: Both plugins read heading structure directly from the post content — the TOC <nav> block does not affect their content analysis.

Themes

The front-end TOC block inherits the active theme's font family, font size, and link color via currentColor and CSS custom properties. TOCflow never injects a branded or third-party font on the front end.

Twenty Twenty-Four Twenty Twenty-Five Astra Kadence GeneratePress OceanWP Blocksy Hello Elementor Any block theme

Page builders

Place [tocflow] in any Shortcode, HTML, or Code element in your page builder. TOCflow automatically reads heading data from each builder's stored meta and injects matching anchor IDs into the rendered page via a late the_content filter (priority 999, runs after all builder output).

BuilderHeading detectionNotes
ElementorHeading widget JSON parsed from _elementor_data metaAdd a Shortcode widget with [tocflow]. Heading and Text Editor widgets are both supported. Works with Elementor Pro.
Bricks BuilderHeading and rich-text elements parsed from _bricks_page_content_2 metaUse a Code or Shortcode element. Bricks heading and rich-text elements both detected.
DiviHTML scan of rendered outputUse a Code module or Shortcode module for [tocflow]. Heading tags inside Divi text/heading modules are captured in the rendered HTML.
Beaver BuilderHTML scan; shortcode detection in builder metaUse an HTML module or Shortcode module. Beaver Builder module data is scanned for tocflow references to trigger ID injection.
WPBakery / Visual ComposerHTML scan of rendered outputUse a Raw HTML element or the Shortcode element. Works with both the Classic and block-based WPBakery.
Oxygen BuilderHTML scan; ct_builder_shortcodes meta detectedUse a Shortcode element or Code Block with [tocflow].
BreakdanceHTML scan; breakdance_data meta detectedUse a Shortcode element. Compatible with Breakdance's heading components.
Gutenberg (native)Block parse via parse_blocks()The canonical integration path. Heading IDs are injected via the render_block filter — no the_content overhead on block sites.

How builder ID injection works: A the_content filter at priority 999 runs after every page builder has finished generating its HTML. TOCflow uses WP_HTML_Tag_Processor (or a regex fallback for older WordPress) to find heading tags without an id attribute and stamps each one with the same slug used in the TOC link. Headings with existing IDs are left untouched.

Multilingual

Plugin / toolStatusNotes
WPML✓ CompatibleAll user-facing strings use the tocflow text domain and are translatable via WPML's string translation module.
Polylang✓ CompatibleNo locale-specific slug or permalink issues.
TranslatePress✓ CompatibleFront-end translated strings render correctly in the TOC.
WooCommerce✓ CompatibleWorks in product descriptions that use Heading blocks (requires WooCommerce block editor for products).
BuddyPress / BuddyBoss✓ CompatibleWorks in any post type registered as public.

10. Developer: build

git clone https://github.com/matthummel-pa/tocflow.git
cd tocflow
npm install
npm run build   # production build → build/
npm run start   # development watch mode

Requires Node.js 18+ and npm 9+. The build uses @wordpress/scripts. Unminified source is in src/; compiled assets land in build/ (gitignored, built on release via GitHub Actions).

11. Developer: PHP filters

Hook into TOCflow's rendering to customize headings, skip post types, or alter the output:

FilterArgsPurpose
tocflow_headings$headings, $post_idModify the heading list before rendering. Each entry has level, text, slug.
tocflow_nav_classes$classes, $attributesAdd or remove CSS classes on the <nav> wrapper.
tocflow_render_nav$html, $attributes, $post_idFilter the final rendered nav HTML.
tocflow_skip_post_types$post_typesReturn an array of post type slugs to exclude from auto-insert.
// Example: exclude headings with a specific CSS class
add_filter( 'tocflow_headings', function( $headings, $post_id ) {
    return array_filter( $headings, function( $h ) {
        return strpos( $h['slug'], 'sponsor' ) === false;
    });
}, 10, 2 );

12. Privacy

TOCflow does not collect personal data, set cookies, or call remote services. Emoji reactions use the browser's own localStorage — no data leaves the reader's device. Citation data is built from post meta that is already public. JSON-LD is printed only if you opt in. Full privacy policy →