Skip to content

Empty id for signature(s) of function named $ #3065

@pjeby

Description

@pjeby

Search terms

signature links, $, empty id

Expected Behavior

Signature blocks's anchor ids should not be empty

Actual Behavior

If a function is named $, the id of its first signature is an empty string, which cannot be linked to. Subsequent signatures are named -1, -2 etc.

The issue is here - the slugger removes "unwanted" characters such as $ without replacing them, and if a name is entirely composed of such signs, an empty and inaccessible id is the result. Presumably an empty slug should be defaulted to something so this doesn't happen, though IIUC that would still leave the -1, -2 etc. links for subequent signatures.

Alternately, the regex could be relaxed, at least for anchor generation, since HTML5 allows darn-near anything in id tags except the empty string or whitespace. Or if it's simpler, perhaps just replacing $ with _ would be the way to go.

Steps to reproduce the bug

Export a function named $ (optionally w/multiple overloads).

Environment

  • TypeDoc version: 0.28.16
  • TypeScript version: 5.4.5
  • Node.js version: 22.13.1
  • OS: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions