#113 · Let moments act as headings
- timeline-app
- pull request
Closes #110. ## Plugin A new official plugin, **Headings** (`moment-headings` v1), gives moments two fields: - `headingLevel`: a select of **Not a heading** or Heading 1–6, stored as `h1`…`h6`. - `headingFont`: a select of named families, defaulting to **Times New Roman (serif)**, then Georgia, Garamond, Palatino, Helvetica, System interface, Courier and Cursive, plus **Custom…**. - Custom accepts a comma-separated CSS family list of installed fonts, such as `Baskerville, serif`. - `fontValue` accepts only font names, quoted or not. No `url()`, functions or `;`, so nothing is downloaded and nothing can be injected. The manifest API gains field kinds `heading` and `font` and marker kind `heading`. The font comes from the manifest's `font` field. ## Display - A single moment with a heading level shows only its title, as the marker itself, centred on the axis where its dot would be. There's no dot, label or stem. - Size follows the level, from 30px for H1 down to 13px for H6. The title has a light backing so the axis line doesn't run through it. - The title is what you click, focus and hover; clicking opens the moment as usual. - **Summaries:** as you chose, headings group and count like any moment. Only a heading shown on its own looks different. Expanded summary fans show headings the same way. - **Disabling:** turning the plugin off, or choosing Not a heading, shows ordinary moments again, and the metadata is kept. ## Library This is the 13th official plugin, so the library's first page (12 to a page) no longer holds them all. The tests that assumed one page now expect 12 on page 1 and *Moment sources* on page 2. ## Tests - **Unit tests** cover levels, the default and custom fonts, font validation (rejecting injection attempts), targets and manifest validation. - **Browser test** (`test/headings-browser.mjs`) checks: - headings render with level, text and font, larger levels larger, with no separate label; - clicking opens the moment; - changing the level and a custom font updates the marker; - Not a heading restores the dot; - zoomed out, a summary counts all three moments. - Passes in Chromium, Firefox and WebKit; the full Chromium and offline suites pass locally.