Skip to content

Group headings in HTML output don't have id attributes for linking #3029

@knoan

Description

@knoan

Search Terms

group heading id, group anchor, categorizeByGroup linking, group permalink, @group tag linking

Expected Behavior

When using @group tags in JSDoc comments with categorizeByGroup: true in TypeDoc configuration, the generated group headings in the HTML output should have id attributes (similar to how individual symbols have them), allowing them to be directly linked to via fragment identifiers.

For example, a group heading like:

<h2>Runtime Guards</h2>

Should be rendered as:

<h2 id="Runtime_Guards">Runtime Guards</h2>

This would enable direct linking to specific groups in documentation (e.g., modules.html#Runtime_Guards).

Actual Behavior

Group headings are rendered without id attributes, making it impossible to create stable, direct links to specific groups in the generated documentation.

Current output:

<h2>Runtime Guards</h2>

Individual symbols within groups do have id attributes and can be linked directly, but the group headings themselves cannot.

Steps to reproduce the bug

Installed packages:

  • typedoc: 0.28.14
  • typescript: 5.9.3
  • node: 22.14.0

Source code with @group tag:

/**
 * Checks if a value is not `undefined` or `null`.
 *
 * @group Runtime Guards
 *
 * @typeParam T The type when the value is defined
 *
 * @returns `true` if the value is neither `undefined` nor `null`
 */
export function isDefined<T>(value: T): value is NonNullable<T> {
  return value !== undefined && value !== null
}

typedoc.json:

{
  "includeVersion": true,
  "sort": ["source-order"],
  "categorizeByGroup": true,
  "groupOrder": [
    "Interfaces",
    "Type Aliases",
    "Runtime Guards",
    "Value Guards",
    "Value Casts",
    "Structural Utilities",
    "Error Utilities",
    "*"
  ]
}

tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": "src",
    "outDir": "dist",
    "strict": true,
    "target": "ES2022",
    "lib": ["ES2022"],
    "module": "ES2022",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "skipLibCheck": true
  },
  "include": ["src"],
  "exclude": ["**/*.*.ts"]
}

Running TypeDoc:

npx typedoc

Generated HTML (docs/modules.html):

<h2>Runtime Guards</h2>
<!-- No id attribute present -->

Individual symbols do have ids:

<dt class="tsd-member-summary" id="isdefined">
  <span class="tsd-member-summary-name">
    <!-- ... -->
  </span>
</dt>

Environment

  • TypeDoc version: 0.28.14
  • TypeScript version: 5.9.3
  • Node.js version: 22.14.0
  • OS: macOS (Darwin 24.6.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueEasier issue for first time contributorshelp wantedContributions are especially encouraged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions