Skip to content

Commit

Permalink
doc: move header options to a menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Feb 1, 2022
1 parent d344f95 commit 304f37d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
1 change: 0 additions & 1 deletion doc/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

* [About this documentation](documentation.md)
* [Usage and example](synopsis.md)
* <a href="index.html">Index</a>

<hr class="line"/>

Expand Down
9 changes: 5 additions & 4 deletions doc/api_assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ em code {
line-height: 1.5rem;
}

#gtoc li {
/* #gtoc li {
white-space: nowrap;
}
} */

li.picker-header {
position: relative;
Expand Down Expand Up @@ -800,6 +800,7 @@ kbd {
position: sticky;
top: -1px;
padding-top: 1rem;
z-index: 1;
}

.header .pinner-header {
Expand Down Expand Up @@ -842,7 +843,7 @@ kbd {
outline: var(--brand3) dotted 2px;
}

@media only screen and (max-width: 576px) {
@media only screen and (max-width: 600px) {
.header.is-pinned {
position: relative;
}
Expand All @@ -856,7 +857,7 @@ kbd {
}
}

@media only screen and (min-width: 577px) {
@media only screen and (min-width: 601px) {
#gtoc > ul > li {
display: inline;
border-right: 1px currentColor solid;
Expand Down
25 changes: 18 additions & 7 deletions doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,26 @@ <h1>Node.js __VERSION__ documentation</h1>
<ul>
<li class="pinner-header">Node.js __VERSION__</li>
__TOC_PICKER__
__ALTDOCS__
__GTOC_PICKER__
<li>
<a href="all.html">View on single page</a>
</li>
<li>
<a href="__FILENAME__.json">View as JSON</a>
__ALTDOCS__
<li class="picker-header">
<a href="#">
<span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
Options
</a>

<div class="picker">
<ul>
<li>
<a href="all.html">View on single page</a>
</li>
<li>
<a href="__FILENAME__.json">View as JSON</a>
</li>
__EDIT_ON_GITHUB__
</ul>
</div>
</li>
__EDIT_ON_GITHUB__
</ul>
</div>
<hr>
Expand Down
8 changes: 7 additions & 1 deletion tools/doc/html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,15 @@ function gtocPicker(id) {
return '';
}

// Highlight the current module and add a link to the index
const gtoc = gtocHTML.replace(
`class="nav-${id}"`, `class="nav-${id} active"`
);
).replace('</ul>', `
<li>
<a href="index.html">Index</a>
</li>
</ul>
`);

return `
<li class="picker-header">
Expand Down

0 comments on commit 304f37d

Please sign in to comment.