fix(metadata): use short deprecation anchors#933
Conversation
Assisted-by: OpenAI Codex
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@vsolano9 is attempting to deploy a commit to the OpenJS Foundation Team on Vercel. A member of the Team first needs to authorize it. |
PR SummaryMedium Risk Overview Legacy HTML skips the extra hidden legacy anchor when it would match the primary slug (common for deprecations now that metadata and legacy sluggers agree on Reviewed by Cursor Bugbot for commit 6eb597b. Bugbot is set up for automated code reviews on this repo. Configure here. |
| ...(legacySlug === data.slug | ||
| ? [] | ||
| : [createElement('span', createElement(`a#${legacySlug}`))]), |
| */ | ||
| const getHeadingSlug = text => { | ||
| const deprecationHeading = | ||
| api === 'deprecations' && DEPRECATION_HEADING_REGEX.exec(text); |
There was a problem hiding this comment.
| api === 'deprecations' && DEPRECATION_HEADING_REGEX.exec(text); | |
| DEPRECATION_HEADING_REGEX.exec(text); |
| return deprecationHeading | ||
| ? nodeSlugger.slug(deprecationHeading[1]).toUpperCase() | ||
| : nodeSlugger.slug(text); |
There was a problem hiding this comment.
Does nodeSlugger need to run on deprecationHeading[1]? Isn't that our slug itself?
Description
Use short
DEP####codes as metadata slugs for headings on the deprecations page. This keeps duplicate handling in the existing stateful slugger, preserves ordinary slugging outsidedeprecations, and avoids emitting a duplicate legacy HTML alias when the primary slug is already short.This changes web and Orama links from long heading-derived fragments to stable links such as
#DEP0001. Legacy JSON andllms.txtoutputs are byte-identical to the base for the tested deprecations source.Assisted-by: OpenAI Codex
Validation
npm ci(0 vulnerabilities)node --run test:ci: 512 passed, 0 failednode --run lint: 0 errors, 2 pre-existing warnings inuseOrama.mjsnode --run format:checkchangeset status --since=mainnode --run test:e2e: 4 passede6e6f677b34ba0fc87e897512feee11e4d2c0ca4withlegacy-html,legacy-json,web,orama-db, andllms-txt; short anchors were verified in legacy HTML, web, and Orama, with legacy JSON andllms.txtunchanged from baseRelated Issues
Fixes #790
Check List
node --run testand all tests passed.node --run format:checkandnode --run lint.