Skip to content

Commit aaad5be

Browse files
committed
use scrollspy on docs pages
1 parent d9da43f commit aaad5be

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

site/assets/scss/_toc.scss

+9-10
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@
1313
nav {
1414
@include font-size(.875rem);
1515

16-
ul {
17-
padding-left: 0;
18-
list-style: none;
19-
20-
ul {
21-
padding-left: 1rem;
22-
margin-top: .25rem;
23-
}
16+
ul ul {
17+
padding-left: 1rem;
18+
margin-top: .25rem;
2419
}
2520

2621
li {
2722
margin-bottom: .25rem;
23+
24+
> .nav-link.active {
25+
background-color: $bd-purple-light;
26+
}
2827
}
2928

3029
a {
3130
color: inherit;
3231

33-
&:not(:hover) {
34-
text-decoration: none;
32+
&:hover:not(.active) {
33+
text-decoration: underline;
3534
}
3635

3736
code {

site/layouts/_default/docs.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{ define "body_override" }}<body data-bs-spy="scroll" data-bs-offset="30" tabindex="0" data-bs-target="#TableOfContents">{{ end }}
12
{{ define "main" }}
23
{{ partial "docs-subnav" . }}
34

@@ -19,7 +20,7 @@ <h1 class="bd-title" id="content">{{ .Title | markdownify }}</h1>
1920
{{ if (eq .Page.Params.toc true) }}
2021
<div class="bd-toc mt-4 mb-5 my-md-0 ps-xl-3 mb-lg-5 text-muted">
2122
<strong class="d-block h6 my-2 pb-2 border-bottom">On this page</strong>
22-
{{ .TableOfContents }}
23+
{{ .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 }}
2324
</div>
2425
{{ end }}
2526

0 commit comments

Comments
 (0)