Skip to content

fix(metadata): preserve underscores in generated anchor IDs#749

Open
thisalihassan wants to merge 1 commit intonodejs:mainfrom
thisalihassan:fix/preserve-underscores-in-slugs
Open

fix(metadata): preserve underscores in generated anchor IDs#749
thisalihassan wants to merge 1 commit intonodejs:mainfrom
thisalihassan:fix/preserve-underscores-in-slugs

Conversation

@thisalihassan
Copy link
Copy Markdown

@thisalihassan thisalihassan commented Apr 4, 2026

Description

The DOC_API_SLUGS_REPLACEMENTS regex was converting underscores to dashes, breaking internal links across the Node.js docs

Tested by generating all 68 doc files, it fixes 16 docs.

Validation

Related Issues

REFS: nodejs/node#62580

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 check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

The DOC_API_SLUGS_REPLACEMENTS regex was converting underscores to
dashes, breaking internal links across the Node.js docs
@thisalihassan thisalihassan requested a review from a team as a code owner April 4, 2026 09:10
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 4, 2026

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

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Apr 4, 2026 9:11am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 4, 2026

PR Summary

Low Risk
Low risk: a small regex tweak to slug generation plus updated unit tests; main impact is changing generated anchor IDs to keep underscores, which could affect consumers relying on the prior hyphenated form.

Overview
Fixes Node.js API-doc anchor/slug generation to preserve underscores by removing _ from the DOC_API_SLUGS_REPLACEMENTS hyphenation regex.

Updates slugger unit tests to assert underscores are kept (e.g., foo_bar, child_process) while other special-character replacements remain unchanged.

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

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.17%. Comparing base (63c24b9) to head (125f770).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #749   +/-   ##
=======================================
  Coverage   77.17%   77.17%           
=======================================
  Files         153      153           
  Lines       13771    13771           
  Branches     1114     1114           
=======================================
  Hits        10628    10628           
  Misses       3139     3139           
  Partials        4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avivkeller avivkeller added the fast track This PR can land before the typical review time, with a :+1: from collaborators label Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fast track This PR can land before the typical review time, with a :+1: from collaborators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants