Skip to content

Commit 2f4854c

Browse files
authored
Sidebar: Added toc to sidebar (#183)
1 parent 3344afc commit 2f4854c

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

assets/css/v2/style.css

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ atomic-search-layout atomic-layout-section[section="search"] {
532532
max-height: 100vh;
533533
overflow: hidden;
534534
scrollbar-gutter: stable;
535+
scrollbar-width: none;
535536
}
536537

537538
.sidebar .scrollbar-container:hover {
@@ -701,7 +702,7 @@ atomic-search-layout atomic-layout-section[section="search"] {
701702

702703
.sidebar .sidebar-navigation ul li .partial {
703704
margin-top: 0;
704-
top: calc(50% - 3.5px);
705+
top: 5px;
705706
left: -13px;
706707
}
707708

@@ -710,10 +711,7 @@ atomic-search-layout atomic-layout-section[section="search"] {
710711
position: relative;
711712
}
712713

713-
.sidebar
714-
.sidebar-navigation
715-
.parent-collapsible-content
716-
li:not(:only-child)::before {
714+
.sidebar .sidebar-navigation .parent-collapsible-content:first-child::before {
717715
content: "";
718716
position: absolute;
719717
border-left: black 1px solid;
@@ -722,6 +720,16 @@ atomic-search-layout atomic-layout-section[section="search"] {
722720
height: calc(100% - 9px - 10px);
723721
}
724722

723+
.sidebar
724+
.sidebar-navigation
725+
.parent-collapsible-content
726+
li:not(:only-child)
727+
a
728+
+ :not(:has(#TableOfContents))
729+
li::before {
730+
border: none;
731+
}
732+
725733
/* First Sidebar Nav Horizontal Lines */
726734
.sidebar
727735
.sidebar-navigation
@@ -751,6 +759,22 @@ atomic-search-layout atomic-layout-section[section="search"] {
751759
align-items: flex-start;
752760
}
753761

762+
/* Table of Contents */
763+
#TableOfContents {
764+
/* Close all TOC on sidebar */
765+
display: none;
766+
}
767+
768+
.collapsible-content li ul li:has(.current) > nav {
769+
/* Open TOC for current page */
770+
display: block !important;
771+
}
772+
773+
#TableOfContents li {
774+
position: relative;
775+
list-style: square;
776+
}
777+
754778
/* content */
755779
main {
756780
flex: 1;

layouts/partials/sidebar-list-pages.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<span class="box-link partial"></span>
2121
{{ end }}
2222
<a href="{{ .Permalink }}" style="{{if eq $currentUrl .Permalink}}font-weight: bold;{{end}}">{{ .Title }} </a>
23+
{{- with .TableOfContents -}}
24+
{{- . -}}
25+
{{- end -}}
2326
{{ end }}
2427
</li>
2528
{{ end }}

0 commit comments

Comments
 (0)