fix(metadata): preserve -- prefix in anchor IDs for CLI flags#758
fix(metadata): preserve -- prefix in anchor IDs for CLI flags#758sujalgoel wants to merge 1 commit intonodejs:mainfrom
Conversation
Two regexes in DOC_API_SLUGS_REPLACEMENTS were stripping -- from the start of slugs, turning --permission into permission and breaking existing links. Fixes nodejs#757
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Updates the Reviewed by Cursor Bugbot for commit 079de38. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #758 +/- ##
==========================================
+ Coverage 78.42% 78.44% +0.01%
==========================================
Files 157 157
Lines 13959 13969 +10
Branches 1152 1155 +3
==========================================
+ Hits 10948 10958 +10
Misses 3006 3006
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #757.
In v25, CLI flag headings like
--permissionproduce anchor#permissioninstead of
#--permission, breaking links that worked in v24.Two regexes in
DOC_API_SLUGS_REPLACEMENTScaused this. The leadinghyphen rule (
^-+(?!-*$)) stripped all leading hyphens unconditionally.The consecutive hyphen rule (
^(?!-+$).*?(--+)) also fired on anythingstarting with
--.Changes in
constants.mjs:^-+(?!-*$)->^-(?=[^-]). Strips only a single-not followed by another, so--permissionpasses through.[^-]after the start anchor so the ruleskips
---prefixed slugs.Changes in
slugger.test.mjs:--fooexpectation from'foo'to'--foo'--permissionand--allow-fs-readTest plan
node --run testnode --run lintnode --run format