fix: preserve deprecation codes in table of contents#919
Conversation
Signed-off-by: Fadhlan <fadhlanzap@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview
A unit test covers the new label behavior; the changeset records a patch for Reviewed by Cursor Bugbot for commit e35d78c. Bugbot is set up for automated code reviews on this repo. Configure here. |
| // Remove any containing code blocks | ||
| .replace(/`/g, '') | ||
| // Remove any prefixes (i.e. 'Class:') | ||
| .replace(/^[^:]+:/, '') |
There was a problem hiding this comment.
Can't we just modify this RegEx to exclude DEPXXXX?
Description
On the deprecations page, sidebar/ToC labels are built by
headingLabelinsrc/generators/jsx-ast/utils/buildBarProps.mjs, which strips any leading<something>:prefix (meant for prefixes likeClass:). That rule also strips deprecation codes, soDEP0001: http.OutgoingMessage.prototype.flushrenders in the ToC as justhttp.OutgoingMessage.prototype.flush, making it hard to locate a deprecation by its ID.This PR adds a narrow exception: headings matching
DEP\d+:keep their full text (backticks removed) as the label, so the deprecation code shows up in the ToC — matching the behavior of the legacy nodejs.org deprecations page.Validation
src/generators/jsx-ast/utils/__tests__/buildBarProps.test.mjs:DEP0001: \http.OutgoingMessage.prototype.flush`now yields the labelDEP0001: http.OutgoingMessage.prototype.flush`.node --run test— 523 tests pass, 0 fail.node --run lint— no errors (2 pre-existing warnings insrc/generators/web/ui/hooks/useOrama.mjs, untouched by this PR).node --run format:check— clean.Related Issues
Fixes #917
Check List
node --run testand all tests passed.node --run format&node --run lint.