GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: wrap TOC in a <details> tag · nodejs/node@f99b38f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc
    • api_assets
      • style.css
    • template.html
  • tools/doc
    • allhtml.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api_assets/style.css‎

Copy file name to clipboardExpand all lines: doc/api_assets/style.css
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ hr {
472472
margin: 0 0 1rem;
473473
}
474474

475-
#toc h2 {
476-
margin: 1.5rem 0;
475+
#toc > ul {
476+
margin-top: 1.5rem;
477477
}
478478

479479
#toc p {
Collapse file

‎doc/template.html‎

Copy file name to clipboardExpand all lines: doc/template.html
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ <h1>Node.js __VERSION__ Documentation</h1>
5555
<hr>
5656
</header>
5757

58-
<div id="toc">
59-
<h2>Table of Contents</h2>
58+
<details id="toc" open>
59+
<summary>Table of Contents</summary>
6060
__TOC__
61-
</div>
61+
</details>
6262

6363
<div id="apicontent">
6464
__CONTENT__
Collapse file

‎tools/doc/allhtml.js‎

Copy file name to clipboardExpand all lines: tools/doc/allhtml.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ for (const link of toc.match(/<a.*?>/g)) {
3131
const data = fs.readFileSync(source + '/' + href, 'utf8');
3232

3333
// Split the doc.
34-
const match = /(<\/ul>\s*)?<\/div>\s*<div id="apicontent">/.exec(data);
34+
const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ id="apicontent">/.exec(data);
3535

3636
contents += data.slice(0, match.index)
37-
.replace(/[\s\S]*?<div id="toc">\s*<h2>.*?<\/h2>\s*(<ul>\s*)?/, '');
37+
.replace(/[\s\S]*?id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*(<ul>\s*)?/, '');
3838

3939
apicontent += data.slice(match.index + match[0].length)
4040
.replace(/<!-- API END -->[\s\S]*/, '')
@@ -59,13 +59,13 @@ let all = toc.replace(/index\.html/g, 'all.html')
5959
all = all.replace(/<title>.*?\| /, '<title>');
6060

6161
// Insert the combined table of contents.
62-
const tocStart = /<div id="toc">\s*<h2>.*?<\/h2>\s*/.exec(all);
62+
const tocStart = /<\w+ id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*/.exec(all);
6363
all = all.slice(0, tocStart.index + tocStart[0].length) +
6464
'<ul>\n' + contents + '</ul>\n' +
6565
all.slice(tocStart.index + tocStart[0].length);
6666

6767
// Replace apicontent with the concatenated set of apicontents from each source.
68-
const apiStart = /<div id="apicontent">\s*/.exec(all);
68+
const apiStart = /<\w+ id="apicontent">\s*/.exec(all);
6969
const apiEnd = all.lastIndexOf('<!-- API END -->');
7070
all = all.slice(0, apiStart.index + apiStart[0].length) +
7171
apicontent +

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.