Skip to content

Commit 3a5cfea

Browse files
authored
Refine scrollspy style and behavior (#2290)
1 parent 4323d09 commit 3a5cfea

7 files changed

Lines changed: 16 additions & 10 deletions

File tree

.vscode/cspell.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
"Docsy",
77
"errorf",
88
"hugo",
9+
"relref",
10+
"scrollspy",
911
"shortcode",
1012
"shortcodes",
1113
"tabpane",
1214
"upvote",
13-
"warnf",
14-
"relref"
15+
"warnf"
1516
]
1617
}

assets/scss/_sidebar-toc.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
&.active {
6464
color: var(--bs-primary);
6565
border-left-color: var(--bs-primary);
66-
font-weight: $font-weight-medium;
66+
background-color: var(--bs-secondary-bg-subtle);
6767
}
6868

6969
&:focus,

layouts/_partials/td/scroll-spy-attr.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{ if not (.Param "ui.scrollspy.disable") -}}
2+
{{ replaceRE `\s+` " "
3+
`
4+
data-bs-spy="scroll"
5+
data-bs-target="#TableOfContents"
6+
data-bs-smooth-scroll="true"
7+
data-bs-root-margin="0px 0px -40%"
8+
`
9+
| strings.TrimSpace | add " " }} {{ end -}}

layouts/blog/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{ partial "navbar.html" . }}
1212
</header>
1313
<div class="container-fluid td-outer">
14-
<div class="td-main" {{ partialCached "td/scroll-spy-attr.txt" . | safeHTMLAttr }}>
14+
<div class="td-main" {{- partialCached "td/scrollspy-attr.txt" . .Section | safeHTMLAttr }}>
1515
<div class="row flex-xl-nowrap">
1616
<aside class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
1717
{{ partial "sidebar.html" . }}

layouts/docs/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{ partial "navbar.html" . }}
1212
</header>
1313
<div class="container-fluid td-outer">
14-
<div class="td-main" {{ partialCached "td/scroll-spy-attr.txt" . | safeHTMLAttr }}>
14+
<div class="td-main" {{- partialCached "td/scrollspy-attr.txt" . .Section | safeHTMLAttr }}>
1515
<div class="row flex-xl-nowrap">
1616
<aside class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
1717
{{ partial "sidebar.html" . }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Blog
3-
menu: {main: {weight: 50}}
3+
menu: { main: { weight: 50 } }
44
---

0 commit comments

Comments
 (0)