FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc: fix stability 1.x links excluding the decimal digit by dario-piotrowicz · Pull Request #58783 · nodejs/node · GitHub

/ node Public

doc: fix stability 1.x links excluding the decimal digit - #58783

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
dario-piotrowicz:dario/doc/stability-1-link-fix
Jun 23, 2025
Merged

doc: fix stability 1.x links excluding the decimal digit#58783
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
dario-piotrowicz:dario/doc/stability-1-link-fix

Conversation

dario-piotrowicz commented Jun 21, 2025
edited
Loading

Copy link
Copy Markdown
Member

Pretty minor, this is just addressing a minimal UI quirk I noticed with the Stability 1.x links where the decimal digits are not included in the hyperlink

PS: I've also moved the regex outside of the preprocessElements function, as there is no reason/benefit to have the regex rebuilt for every file (having it outside might save some precious nanoseconds when building the docs 😅).

Before

After

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/web-infra

nodejs-github-bot added doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory. labels Jun 21, 2025
dario-piotrowicz force-pushed the dario/doc/stability-1-link-fix branch from 0c3c90c to 391b587 Compare June 21, 2025 22:24

Hardanish-Singh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM!

dario-piotrowicz added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jun 22, 2025
Comment thread tools/doc/html.mjs
node.children.unshift({
type: 'html',
value: `<div class="api_stability api_stability_${number}">` +
value: `<div class="api_stability api_stability_${parseInt(number)}">` +

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

parseInt will only grab the numeric pieces of "number" right?

dario-piotrowicz Jun 22, 2025
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, in the regex that the part for number is /\d(?:\.\d)? meaning that the number matched value can be a single digit optionally followed by a dot followed by another digit, parseInt run on such numbers/strings always returns the integer part of the number:

And that's the part we need based on the css classes we have:

.api_stability_0 {
background-color: var(--red1);
}
.api_stability_1 {
background-color: var(--red3);
}
.api_stability_2 {
background-color: var(--green2);
}
.api_stability_3 {
background-color: var(--blue1);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I used the same trick in the web generator :-)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I just wanted to confirm. I recall either parseInt or Number() parse the numeric parseable stuff until it finds something non-numeric.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No, not until it finds something non-numeric. It parses the float since it's a valid number, and flattens it to an integer.

Comment thread tools/doc/html.mjs

avivkeller commented Jun 23, 2025
edited
Loading

Copy link
Copy Markdown
Member

Note to web infra teams: this doesn't need to be ported to api-docs-tooling, I (independently from this) changed the logic to something similar in the web generator PR.

Copy link
Copy Markdown
Member Author

Note to web infra teams: this doesn't need to be ported to api-docs-tooling, I (independently from this) changed the logic to something similar in the web generator PR.

Thanks, I was about to ask someone at some point if this needed porting (as I haven't looked too much into the new tooling I must admit 😓) but you saved me the effort 🫶

dario-piotrowicz added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 23, 2025
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 23, 2025
nodejs-github-bot merged commit d8de8f3 into nodejs:main Jun 23, 2025

Copy link
Copy Markdown
Collaborator

Landed in d8de8f3

ovflowd commented Jun 23, 2025

Copy link
Copy Markdown
Member

I wish I could have landed this haha; Ah how it sucks not being a collaborator anymore lol

RafaelGSS pushed a commit that referenced this pull request Jun 24, 2025
PR-URL: #58783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2025
PR-URL: #58783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 24, 2025
PR-URL: #58783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL