Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ title: Changelog
### Features

- Introduced `generateOutputsBegin` and `generateOutputsEnd` events on `Application` for plugin use.
- Group/category section headings (`<h2>`) in the default theme now include an `id` attribute so they can be linked to via fragment identifiers (e.g. `modules.html#runtime-guards`), #3029.

## v0.28.19 (2026-04-12)

Expand Down
12 changes: 10 additions & 2 deletions src/lib/output/themes/default/partials/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@ import { classNames, getMemberSections, isNoneSection, type MemberSection, rende
import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext.js";
import { i18n, JSX } from "#utils";
import type { ContainerReflection } from "../../../../models/index.js";
import { anchorIcon } from "./anchor-icon.js";

function renderSection(
{ urlTo, reflectionIcon, getReflectionClasses, markdown }: DefaultThemeRenderContext,
context: DefaultThemeRenderContext,
item: MemberSection,
) {
const { urlTo, reflectionIcon, getReflectionClasses, markdown, slugger } = context;
const sectionAnchor = !isNoneSection(item) ? slugger.slug(item.title) : undefined;
return (
<section class="tsd-index-section">
{!isNoneSection(item) && <h3 class="tsd-index-heading">{item.title}</h3>}
{!isNoneSection(item) && (
<h3 class="tsd-index-heading tsd-anchor-link" id={sectionAnchor}>
{item.title}
{anchorIcon(context, sectionAnchor)}
</h3>
)}
{item.description && (
<div class="tsd-comment tsd-typography">
<JSX.Raw html={markdown(item.description)} />
Expand Down
5 changes: 4 additions & 1 deletion src/lib/output/themes/default/partials/members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext.js"
import { JSX } from "#utils";
import { type ContainerReflection } from "../../../../models/index.js";
import { getMemberSections, isNoneSection } from "../../lib.js";
import { anchorIcon } from "./anchor-icon.js";

export function members(context: DefaultThemeRenderContext, props: ContainerReflection) {
const sections = getMemberSections(props, (child) => !context.router.hasOwnDocument(child));
Expand All @@ -18,13 +19,15 @@ export function members(context: DefaultThemeRenderContext, props: ContainerRefl
}

context.page.startNewSection(section.title);
const sectionAnchor = context.slugger.slug(section.title);

return (
<details class="tsd-panel-group tsd-member-group tsd-accordion" open>
<summary class="tsd-accordion-summary" data-key={"section-" + section.title}>
{context.icons.chevronDown()}
<h2>
<h2 class="tsd-anchor-link" id={sectionAnchor}>
{section.title}
{anchorIcon(context, sectionAnchor)}
</h2>
</summary>
<section>{section.children.map((item) => context.member(item))}</section>
Expand Down
5 changes: 4 additions & 1 deletion src/lib/output/themes/default/partials/moduleReflection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ export function moduleReflection(context: DefaultThemeRenderContext, mod: Declar
);
}

const sectionAnchor = context.slugger.slug(section.title);

return (
<details class="tsd-panel-group tsd-member-group tsd-accordion" open>
<summary class="tsd-accordion-summary" data-key={"section-" + section.title}>
{context.icons.chevronDown()}
<h2>
<h2 class="tsd-anchor-link" id={sectionAnchor}>
{section.title}
{anchorIcon(context, sectionAnchor)}
</h2>
</summary>
{content}
Expand Down
44 changes: 40 additions & 4 deletions src/test/renderer/specs/classes/BaseClass.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@
{
"section.tsd-index-section": [
{
"h3.tsd-index-heading": "Constructors"
"h3.tsd-index-heading.tsd-anchor-link#constructors": [
"Constructors",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#constructors",
"aria-label": "Permalink"
}
}
]
},
{
"div.tsd-index-list": [
Expand All @@ -126,7 +135,16 @@
{
"section.tsd-index-section": [
{
"h3.tsd-index-heading": "Methods"
"h3.tsd-index-heading.tsd-anchor-link#methods": [
"Methods",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#methods",
"aria-label": "Permalink"
}
}
]
},
{
"div.tsd-index-list": [
Expand Down Expand Up @@ -172,7 +190,16 @@
"data-key": "section-Constructors"
},
"children": {
"h2": "Constructors"
"h2.tsd-anchor-link#constructors-1": [
"Constructors",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#constructors-1",
"aria-label": "Permalink"
}
}
]
}
},
{
Expand Down Expand Up @@ -261,7 +288,16 @@
"data-key": "section-Methods"
},
"children": {
"h2": "Methods"
"h2.tsd-anchor-link#methods-1": [
"Methods",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#methods-1",
"aria-label": "Permalink"
}
}
]
}
},
{
Expand Down
44 changes: 40 additions & 4 deletions src/test/renderer/specs/classes/GH3007.DOMBase.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,16 @@
{
"section.tsd-index-section": [
{
"h3.tsd-index-heading": "Constructors"
"h3.tsd-index-heading.tsd-anchor-link#constructors": [
"Constructors",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#constructors",
"aria-label": "Permalink"
}
}
]
},
{
"div.tsd-index-list": [
Expand All @@ -117,7 +126,16 @@
{
"section.tsd-index-section": [
{
"h3.tsd-index-heading": "Methods"
"h3.tsd-index-heading.tsd-anchor-link#methods": [
"Methods",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#methods",
"aria-label": "Permalink"
}
}
]
},
{
"div.tsd-index-list": [
Expand Down Expand Up @@ -153,7 +171,16 @@
"data-key": "section-Constructors"
},
"children": {
"h2": "Constructors"
"h2.tsd-anchor-link#constructors-1": [
"Constructors",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#constructors-1",
"aria-label": "Permalink"
}
}
]
}
},
{
Expand Down Expand Up @@ -317,7 +344,16 @@
"data-key": "section-Methods"
},
"children": {
"h2": "Methods"
"h2.tsd-anchor-link#methods-1": [
"Methods",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#methods-1",
"aria-label": "Permalink"
}
}
]
}
},
{
Expand Down
22 changes: 20 additions & 2 deletions src/test/renderer/specs/classes/GH3007.DOMClass.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,16 @@
"div.tsd-accordion-details": {
"section.tsd-index-section": [
{
"h3.tsd-index-heading": "Methods"
"h3.tsd-index-heading.tsd-anchor-link#methods": [
"Methods",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#methods",
"aria-label": "Permalink"
}
}
]
},
{
"div.tsd-index-list": [
Expand Down Expand Up @@ -131,7 +140,16 @@
"data-key": "section-Methods"
},
"children": {
"h2": "Methods"
"h2.tsd-anchor-link#methods-1": [
"Methods",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#methods-1",
"aria-label": "Permalink"
}
}
]
}
},
{
Expand Down
22 changes: 20 additions & 2 deletions src/test/renderer/specs/classes/GH3014.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@
"div.tsd-accordion-details": {
"section.tsd-index-section": [
{
"h3.tsd-index-heading": "Constructors"
"h3.tsd-index-heading.tsd-anchor-link#constructors": [
"Constructors",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#constructors",
"aria-label": "Permalink"
}
}
]
},
{
"div.tsd-index-list": [
Expand Down Expand Up @@ -125,7 +134,16 @@
"data-key": "section-Constructors"
},
"children": {
"h2": "Constructors"
"h2.tsd-anchor-link#constructors-1": [
"Constructors",
{
"tag": "a.tsd-anchor-icon",
"props": {
"href": "#constructors-1",
"aria-label": "Permalink"
}
}
]
}
},
{
Expand Down
Loading
Loading