← Back to Pull requests

fix(metadata): keep hyphens in heading slugs like the old doc tooling #1232

Closed
unknown closed this pull request without merging on Nov 05, 2026 18:57 UTC
View on GitHub
unknown unknown commented on Nov 01, 2026 21:49 UTC
Author

Description

This PR makes heading anchors match the old Node.js doc tooling again, by dropping the three hyphen rules from DOC_API_SLUGS_REPLACEMENTS.

#610 swapped the --+ collapse for /^(?!-)(?!-+$).*?(--+)/, which also swallows everything before the first run of hyphens. That's how nodejs.org/api ends up serving #-check for -c, --check. The old tooling (getId in tools/doc/html.mjs) never collapsed or trimmed hyphens at all: it lowercased, dropped punctuation and turned spaces into hyphens, which is what github-slugger already does. So rather than fixing the collapse, this stops post-processing hyphens.

| Heading | v24 docs (old tooling) | main | This PR |
| --- | --- | --- | --- |
| -c, --check | #-c---check | #-check | #-c---check |
| new ReadableStream([underlyingSource [, strategy]]) | #new-readablestreamunderlyingsource--strategy | #-strategy | #new-readablestreamunderlyingsource--strategy |

It's the same drift #757 reported for -- flags, which #810 fixed for that one case. The slugger tests now pin the old tooling's behaviour; the ones they replace came from #676 and captured #610's output (foo--bar → -bar).

Validation

  • node --run test (782 tests), node --run lint and node --run format:check pass.

  • Over all 5,809 headings in nodejs/node's doc/api, the slugs now match the old getId exactly. On main, 18 of them differ.

  • Generating cli.md with legacy-html gives #-c---check and #-e---eval-script, as in the v24 docs.
  • Opening cli.html#-c---check, the v24 anchor, in a legacy-html build of cli.md:

    | main | This PR |
    | --- | --- |
    | <img width="1280" height="720" alt="main: the page stays at the top, as the anchor doesn't exist" src="https://github.com/user-attachments/assets/6d59eefd-5ff8-4aed-b866-9bdd949e9086" /> | <img width="1280" height="720" alt="This PR: the page scrolls to the -c, --check heading" src="https://github.com/user-attachments/assets/a4312375-52b3-4ad9-a689-f1301f746df6" /> |

    Related Issues

    Refs: #757, #610

    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:check & node --run lint.
  • Diff: 296 lines (+222 / -74) across 3 files Reviewer: avivkeller Review duration: 5588m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 296 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.341
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1232"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.0% (MEDIUM) · Higher = larger blast radius
    40.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.8% · Safe to merge
    15.8%
    Repository