Confluence Table of Contents Injector
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Confluence Table of Contents Injector scans any Confluence wiki page and generates a floating, draggable Table of Contents from the page's heading structure (h1 through h6). The TOC panel appears on the side of the page with all headings displayed in hierarchical indentation, making it easy to see the page structure at a glance. Click any heading to scroll smoothly to that section—the target heading highlights briefly to confirm navigation. The scroll spy feature automatically highlights the current section in the TOC as you scroll, showing exactly where you are in the document. You can drag the TOC panel to any position on the screen, collapse it when not needed, and copy the entire TOC as a formatted list. This makes navigating long documentation pages, design specs, and meeting notes significantly faster.
WHERE IT RUNS
This script runs on Confluence wiki pages (*.atlassian.net/wiki/*). It operates entirely within your browser tab, reading the page's DOM to locate heading elements and injecting a floating panel. The script cannot access other tabs, your browsing history, bookmarks, downloads, or any data outside the current page. All settings—including TOC position, max heading depth, scroll spy visibility, auto-collapse preference, highlight color, and auto-detect preference—are stored locally using GM_setValue and never transmitted anywhere.
HOW TO USE
After installing with the BotGentz extension, the script automatically detects Confluence pages and injects the TOC (if auto-detect is enabled). The TOC appears on the right side of the page with all headings listed. Click any heading to scroll to that section—the heading highlights in blue. The scroll spy highlights the current section as you scroll. Drag the TOC by its header to reposition it anywhere on the screen. Click the ✕ button to hide the TOC, and use "Refresh TOC" to rebuild it if the page content changes. Click "Inject TOC" to manually add it if auto-detect is off. Customize the TOC position (left or right), set the maximum heading depth (H1-H2 to H1-H6), and toggle scroll spy on or off. Click "Copy TOC as List" to copy the table of contents as a formatted text list.
THE REAL MECHANISM
The script detects Confluence page content using selectors like .wiki-content, .page-content, [data-testid="page-content"], and .article-content. It extracts all heading elements (h1-h6) from the content area, capturing each heading's text, level, and ID (or generating one if missing). The TOC is built as a nested unordered list with indentation based on heading level, limited by the user's max depth setting. Click handlers on each TOC link use scrollIntoView with smooth behavior and highlight the target heading with a temporary background color. The scroll spy uses a throttled scroll event listener that checks each heading's offset position relative to the current scroll position, updating the active class on the corresponding TOC link. The TOC panel is positioned absolutely with drag support using mousedown/mousemove/mouseup events. All DOM manipulation uses safe methods with no innerHTML from untrusted content.
THE PANEL
The TOC Injector panel is a BGPanel component that you can drag anywhere on your screen by its header. It snaps to the nearest edge when released, keeping your workspace organized. The panel collapses to a small bubble showing only the emoji icon when minimised—click to expand it again. You can resize the panel horizontally to see more of the settings. Press the Escape key to collapse the panel instantly. Your panel position and size are saved per-site.
PLEASE NOTE
This script requires the free BotGentz browser extension to function. Confluence frequently updates its UI, which may change class names, data-testid attributes, and DOM structure—the script may require updates to maintain compatibility. The TOC generation depends on heading elements being present in the page; pages with no headings will not show a TOC. The scroll spy relies on heading positions and may not work perfectly with dynamically loaded content or sticky headers. The script never reads or writes password fields, hidden inputs, or file inputs. It stores only your TOC position, max depth, scroll spy visibility, auto-collapse preference, highlight color, and auto-detect preference locally. No page content, user data, or personal information is ever collected, transmitted, or shared.