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

PR-URL: https://github.com/nodejs/node/pull/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 commit is contained in:
Dario Piotrowicz 2025-06-23 23:30:45 +01:00 committed by GitHub
parent 5f3262add6
commit d8de8f3d6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -206,10 +206,11 @@ function linkJsTypeDocs(text) {
const isJSFlavorSnippet = (node) => node.lang === 'cjs' || node.lang === 'mjs';
const STABILITY_RE = /(.*:)\s*(\d(?:\.\d)?)([\s\S]*)/;
// Preprocess headers, stability blockquotes, and YAML blocks.
export function preprocessElements({ filename }) {
return (tree) => {
const STABILITY_RE = /(.*:)\s*(\d)([\s\S]*)/;
let headingIndex = -1;
let heading = null;
@ -325,7 +326,7 @@ export function preprocessElements({ filename }) {
// Insert div with prefix and number
node.children.unshift({
type: 'html',
value: `<div class="api_stability api_stability_${number}">` +
value: `<div class="api_stability api_stability_${parseInt(number)}">` +
(noLinking ? '' :
'<a href="documentation.html#stability-index">') +
`${prefix} ${number}${noLinking ? '' : '</a>'}`