Skip to content

Commit 507f1db

Browse files
Trotttargos
authored andcommitted
tools: udpate doc tools to accommodate GFM footnotes
PR-URL: #40477 Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 9f46fca commit 507f1db

File tree

3 files changed

+426
-166
lines changed

3 files changed

+426
-166
lines changed

tools/doc/allhtml.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ for (const link of toc.match(/<a.*?>/g)) {
5252
.replace(/<a href="#(?!DEP[0-9]{4})([^"]+)"/g, (match, anchor) => {
5353
return `<a href="#${moduleName}_${anchor}"`;
5454
})
55+
// Update footnote id attributes on anchors
56+
.replace(/<a href="([^"]+)" id="(user-content-fn[^"]+)"/g, (match, href, id) => {
57+
return `<a href="${href}" id="${moduleName}_${id}"`;
58+
})
59+
// Update footnote id attributes on list items
60+
.replace(/<(\S+) id="(user-content-fn-\d+)"/g, (match, tagName, id) => {
61+
return `<${tagName} id="${moduleName}_${id}"`;
62+
})
5563
// Prefix all links to other docs modules with those module names
5664
.replace(/<a href="((\w[^#"]*)\.html)#/g, (match, href, linkModule) => {
5765
if (!htmlFiles.includes(href)) return match;

0 commit comments

Comments
 (0)