# module-table-of-contents

## A placeable table of contents that Core builds from the page's final visible headings.

## One module owns the list

`module-table-of-contents` is placed like any other module in `page.layout.sections`. The page JSON supplies its heading and accessible name, while Core alone builds the links and anchor targets.

This provides one clear owner even when the page contains several `module-text` instances.

### Headings are collected after rendering

The list reads the final visible DOM structure. Hidden items are skipped and headings appear in the same order in which users encounter them on the page.

Heading from module-custom

## Custom sections are included automatically

An ordinary custom section only needs correct semantics: a page-unique section, a visible H2 and an accessible name. The table of contents reads the result after rendering and links to the same stable section ID.

- **Section** A clear content surface
- **H2** Visible and language-specific
- **Stable ID** A safe anchor target

## One article can span several modules

On this page, `page.article` starts at the first text module and ends at this one. The custom section between them therefore belongs to the same semantic article, while the table of contents sits before the article and still reads the page's entire `<main>`.

### Core makes anchor targets unique across the page

Every link points to exactly one visible target. Internal fragment links are navigation and therefore do not receive the outbound `track-clicks` class.
