Skip to content

fix(metadata): use short deprecation anchors#933

Open
vsolano9 wants to merge 1 commit into
nodejs:mainfrom
vsolano9:codex/issue-790-deprecation-links
Open

fix(metadata): use short deprecation anchors#933
vsolano9 wants to merge 1 commit into
nodejs:mainfrom
vsolano9:codex/issue-790-deprecation-links

Conversation

@vsolano9

Copy link
Copy Markdown

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 outside deprecations, 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 and llms.txt outputs are byte-identical to the base for the tested deprecations source.

Assisted-by: OpenAI Codex

Validation

  • Node.js v24.14.0
  • npm ci (0 vulnerabilities)
  • focused metadata parser test: 27 passed
  • node --run test:ci: 512 passed, 0 failed
  • node --run lint: 0 errors, 2 pre-existing warnings in useOrama.mjs
  • node --run format:check
  • changeset status --since=main
  • node --run test:e2e: 4 passed
  • generated Node.js deprecations source at e6e6f677b34ba0fc87e897512feee11e4d2c0ca4 with legacy-html, legacy-json, web, orama-db, and llms-txt; short anchors were verified in legacy HTML, web, and Orama, with legacy JSON and llms.txt unchanged from base

Related Issues

Fixes #790

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have checked code formatting with node --run format:check and node --run lint.
  • I have covered the new functionality with unit tests.

@vsolano9
vsolano9 requested a review from a team as a code owner July 22, 2026 12:19
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Jul 22, 2026 12:21pm

Request Review

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

@vsolano9 is attempting to deploy a commit to the OpenJS Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Published doc fragment URLs for deprecations change from long slugs to DEP####, which can break existing deep links unless legacy alias anchors still differ; scope is limited to the deprecations page and slug generation.

Overview
Deprecation headings on the deprecations API doc now get metadata slugs from the DEP#### prefix (e.g. #DEP0001) instead of long title-derived fragments, so web, Orama, and TOC links stay short and stable. Duplicate codes still go through the existing slugger (DEP0001-1, etc.); headings that look like deprecations on other pages keep normal slugs.

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 DEP####). A patch changeset documents the @node-core/doc-kit behavior change.

Reviewed by Cursor Bugbot for commit 6eb597b. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment on lines +32 to +34
...(legacySlug === data.slug
? []
: [createElement('span', createElement(`a#${legacySlug}`))]),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, no?

*/
const getHeadingSlug = text => {
const deprecationHeading =
api === 'deprecations' && DEPRECATION_HEADING_REGEX.exec(text);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
api === 'deprecations' && DEPRECATION_HEADING_REGEX.exec(text);
DEPRECATION_HEADING_REGEX.exec(text);

Comment on lines +59 to +61
return deprecationHeading
? nodeSlugger.slug(deprecationHeading[1]).toUpperCase()
: nodeSlugger.slug(text);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does nodeSlugger need to run on deprecationHeading[1]? Isn't that our slug itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Long and short deprecation links

2 participants