tools,doc: fix global table of content active element

Assign active class to the correct HTML element when one nav-id is a
subset of another one (E.G.: `nav-module` and `nav-modules`).

Fixes: https://github.com/nodejs/node/issues/34975

PR-URL: https://github.com/nodejs/node/pull/34976
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
This commit is contained in:
Antoine du Hamel authored and Anna Henningsen committed 2020-09-22 19:56:40 +02:00
1 parent 9107595acd
commit 0ec3e6138e
1 file changed
+1 -1
+1 -1
View File
@@ -74,7 +74,7 @@ function toHTML({ input, content, filename, nodeVersion, versions }) {
.replace(/__VERSION__/g, nodeVersion)
.replace('__TOC__', content.toc)
.replace('__GTOC__', gtocHTML.replace(
`class="nav-${id}`, `class="nav-${id} active`))
`class="nav-${id}"`, `class="nav-${id} active"`))
.replace('__EDIT_ON_GITHUB__', editOnGitHub(filename))
.replace('__CONTENT__', content.toString());