tools,doc: add "legacy" badge in the TOC

PR-URL: https://github.com/nodejs/node/pull/37949
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel 2021-03-27 19:22:03 +01:00 committed by Myles Borins
parent 4ef102d34e
commit 51e7a33d54
No known key found for this signature in database
GPG Key ID: 933B01F40B5CA946
2 changed files with 11 additions and 3 deletions

View File

@ -515,6 +515,14 @@ hr {
padding: 1px 3px;
border-radius: 3px;
}
#toc .stability_3::after {
background-color: var(--blue1);
color: var(--white);
content: "legacy";
margin-left: .25rem;
padding: 1px 3px;
border-radius: 3px;
}
#apicontent li {
margin-bottom: .5rem;

View File

@ -265,9 +265,9 @@ function preprocessElements({ filename }) {
const [, prefix, number, explication] =
text.value.match(STABILITY_RE);
const isStabilityIndex =
index - 2 === headingIndex || // General.
index - 3 === headingIndex; // With api_metadata block.
// Stability indices are never more than 3 nodes away from their
// heading.
const isStabilityIndex = index - headingIndex <= 3;
if (heading && isStabilityIndex) {
heading.stability = number;