Skip to content

metadata: preserve CLI flag anchors#810

Open
Herrtian wants to merge 1 commit into
nodejs:mainfrom
Herrtian:preserve-cli-flag-anchors
Open

metadata: preserve CLI flag anchors#810
Herrtian wants to merge 1 commit into
nodejs:mainfrom
Herrtian:preserve-cli-flag-anchors

Conversation

@Herrtian
Copy link
Copy Markdown

Fixes #757.

Preserves generated anchors for CLI flags that start with --, while keeping the existing single-leading-hyphen cleanup.

Checks:

  • npm ci
  • npm test -- src/generators/metadata/utils/tests/slugger.test.mjs
  • npm run format:check -- src/generators/metadata/constants.mjs src/generators/metadata/utils/tests/slugger.test.mjs
  • npm run lint
  • git diff --check

Signed-off-by: Herrtian <70463940+Herrtian@users.noreply.github.com>
@Herrtian Herrtian requested a review from a team as a code owner May 25, 2026 14:32
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

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

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview May 25, 2026 2:34pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 25, 2026

PR Summary

Low Risk
Small regex changes in doc anchor generation with targeted tests; no auth, runtime API, or data-path impact.

Overview
Tightens metadata slug rules in DOC_API_SLUGS_REPLACEMENTS so generated anchor IDs keep CLI flags that start with --, while still stripping a lone leading hyphen on other titles.

Leading-hyphen cleanup now removes only one leading - (not runs like --). The rule that collapses -- in the middle of a slug no longer runs when the string begins with --, so flags such as --permission and --allow-fs-read stay intact. Slugger tests were updated to match (e.g. --permission preserved, new case for --allow-fs-read).

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

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.

[v25] Anchors without -- prefix

2 participants