Skip to content

fix(web): shorten method labels in sidebar#798

Open
panva wants to merge 2 commits into
nodejs:mainfrom
panva:fix/sidebar-compact-signatures
Open

fix(web): shorten method labels in sidebar#798
panva wants to merge 2 commits into
nodejs:mainfrom
panva:fix/sidebar-compact-signatures

Conversation

@panva
Copy link
Copy Markdown
Member

@panva panva commented May 17, 2026

The TOCs are barely usable when methods include their possibly many parameters.

before after
sidebar-before-webcrypto-toc sidebar-after-webcrypto-toc

@panva panva requested a review from a team as a code owner May 17, 2026 16:58
@cursor
Copy link
Copy Markdown

cursor Bot commented May 17, 2026

PR Summary

Low Risk
Low risk string-formatting change to sidebar/ToC labels; main concern is potential edge cases in heading parsing or unexpected collisions affecting displayed text (not slugs).

Overview
Updates extractHeadings in buildBarProps.mjs to generate compact ToC labels for method-like headings (e.g., fs.readFile()), stripping parameter lists and new, while falling back to full signatures when a compact label would collide with another entry.

Refactors heading formatting into helpers and extends tests to cover compacting behavior and collision handling.

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

@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 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 17, 2026 6:42pm

Request Review

@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

❌ Patch coverage is 95.52239% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.85%. Comparing base (fb15e44) to head (2e28a03).

Files with missing lines Patch % Lines
src/generators/jsx-ast/utils/buildBarProps.mjs 91.30% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #798      +/-   ##
==========================================
+ Coverage   82.82%   82.85%   +0.02%     
==========================================
  Files         169      169              
  Lines       14670    14788     +118     
  Branches     1259     1270      +11     
==========================================
+ Hits        12151    12253     +102     
- Misses       2513     2529      +16     
  Partials        6        6              

☔ 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.

Copy link
Copy Markdown
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are intentionally expanded, since the short version credits scenarios were multiple headings have the same navigation entry.

The correct approach to shortening these would be to revert the change that expanded them, and consolidate duplicate ToC entries into one.

@panva
Copy link
Copy Markdown
Member Author

panva commented May 17, 2026

These are intentionally expanded

Bold.

There are only ~26-29 collisions in all our docs. I've updated it to keep the compact form when it is unique otherwise keep the full one.

Screenshot 2026-05-17 at 20 39 39

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.

2 participants