Skip to content

Commit 97fbfd8

Browse files
dario-piotrowiczRafaelGSS
authored andcommitted
doc: fix stability 1.x links excluding the decimal digit
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>
1 parent 7643ce9 commit 97fbfd8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/doc/html.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,11 @@ function linkJsTypeDocs(text) {
206206

207207
const isJSFlavorSnippet = (node) => node.lang === 'cjs' || node.lang === 'mjs';
208208

209+
const STABILITY_RE = /(.*:)\s*(\d(?:\.\d)?)([\s\S]*)/;
210+
209211
// Preprocess headers, stability blockquotes, and YAML blocks.
210212
export function preprocessElements({ filename }) {
211213
return (tree) => {
212-
const STABILITY_RE = /(.*:)\s*(\d)([\s\S]*)/;
213214
let headingIndex = -1;
214215
let heading = null;
215216

@@ -325,7 +326,7 @@ export function preprocessElements({ filename }) {
325326
// Insert div with prefix and number
326327
node.children.unshift({
327328
type: 'html',
328-
value: `<div class="api_stability api_stability_${number}">` +
329+
value: `<div class="api_stability api_stability_${parseInt(number)}">` +
329330
(noLinking ? '' :
330331
'<a href="documentation.html#stability-index">') +
331332
`${prefix} ${number}${noLinking ? '' : '</a>'}`

0 commit comments

Comments
 (0)