Skip to content

Commit

Permalink
use scrollspy on docs pages
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Jun 3, 2021
1 parent 08139c2 commit 0f2c5ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
19 changes: 9 additions & 10 deletions site/assets/scss/_toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@
nav {
@include font-size(.875rem);

ul {
padding-left: 0;
list-style: none;

ul {
padding-left: 1rem;
margin-top: .25rem;
}
ul ul {
padding-left: 1rem;
margin-top: .25rem;
}

li {
margin-bottom: .25rem;

> .nav-link.active {
background-color: $bd-purple-light;
}
}

a {
color: inherit;

&:not(:hover) {
text-decoration: none;
&:hover:not(.active) {
text-decoration: underline;
}

code {
Expand Down
3 changes: 2 additions & 1 deletion site/layouts/_default/docs.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ define "body_override" }}<body data-bs-spy="scroll" data-bs-offset="30" tabindex="0" data-bs-target="#TableOfContents">{{ end }}
{{ define "main" }}
{{ partial "docs-subnav" . }}

Expand All @@ -19,7 +20,7 @@ <h1 class="bd-title" id="content">{{ .Title | markdownify }}</h1>
{{ if (eq .Page.Params.toc true) }}
<div class="bd-toc mt-4 mb-5 my-md-0 ps-xl-3 mb-lg-5 text-muted">
<strong class="d-block h6 my-2 pb-2 border-bottom">On this page</strong>
{{ .TableOfContents }}
{{ .Page.TableOfContents | replaceRE "(<li>)" "<li class=\"nav-item\">" | replaceRE "(<ul>)" "<ul class=\"nav nav-pills flex-column\">" | replaceRE "(?s:href)" "class=\"nav-link py-0 px-1\" href" | safeHTML }}
</div>
{{ end }}

Expand Down

0 comments on commit 0f2c5ce

Please sign in to comment.