Skip to content
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

doc: enable GFM footnotes in docs #40477

Merged
merged 2 commits into from
Oct 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
tools: udpate doc tools to accommodate GFM footnotes
PR-URL: #40477
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
Trott committed Oct 23, 2021
commit 179248a7b9f15cd855eb235116242a5d57d6c2b6
8 changes: 8 additions & 0 deletions tools/doc/allhtml.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading