tools: udpate doc tools to accommodate GFM footnotes

PR-URL: https://github.com/nodejs/node/pull/40477
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Rich Trott authored and Michaël Zasso committed 2021-11-06 10:56:41 +01:00
1 parent 9f46fca124
commit 507f1dbc8d
3 files changed
+426 -166

No files matched your search

+8
View File
@@ -52,6 +52,14 @@ for (const link of toc.match(/<a.*?>/g)) {
.replace(/<a href="#(?!DEP[0-9]{4})([^"]+)"/g, (match, anchor) => {
return `<a href="#${moduleName}_${anchor}"`;
})
// Update footnote id attributes on anchors
.replace(/<a href="([^"]+)" id="(user-content-fn[^"]+)"/g, (match, href, id) => {
return `<a href="${href}" id="${moduleName}_${id}"`;
})
// Update footnote id attributes on list items
.replace(/<(\S+) id="(user-content-fn-\d+)"/g, (match, tagName, id) => {
return `<${tagName} id="${moduleName}_${id}"`;
})
// Prefix all links to other docs modules with those module names
.replace(/<a href="((\w[^#"]*)\.html)#/g, (match, href, linkModule) => {
if (!htmlFiles.includes(href)) return match;
+414 -162
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -12,14 +12,14 @@
"rehype-raw": "^6.1.0",
"rehype-stringify": "^9.0.2",
"remark-frontmatter": "^4.0.0",
"remark-gfm": "^2.0.0",
"remark-html": "^14.0.1",
"remark-gfm": "^3.0.0",
"remark-html": "^15.0.0",
"remark-parse": "^10.0.0",
"remark-rehype": "^9.0.0",
"remark-rehype": "^10.0.0",
"to-vfile": "^7.2.2",
"unified": "^10.1.0",
"unist-util-select": "^4.0.0",
"unist-util-visit": "^4.0.0"
"unist-util-visit": "^4.1.0"
},
"bin": {
"node-doc-generator": "generate.js"