-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
doc: fix stability 1.x links excluding the decimal digit #58783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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)}">` + | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parseInt will only grab the numeric pieces of "number" right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, in the regex that the part for And that's the part we need based on the css classes we have: Lines 324 to 338 in d7becc5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the same trick in the web generator :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just wanted to confirm. I recall either parseInt or Number() parse the numeric parseable stuff until it finds something non-numeric. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, not until it finds something non-numeric. It parses the float since it's a valid number, and flattens it to an integer. |
||||||||||||||||||||||||||||||||
(noLinking ? '' : | ||||||||||||||||||||||||||||||||
'<a href="documentation.html#stability-index">') + | ||||||||||||||||||||||||||||||||
`${prefix} ${number}${noLinking ? '' : '</a>'}` | ||||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.