Skip to content

Added toc to sidebar #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions assets/css/v2/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ atomic-search-layout atomic-layout-section[section="search"] {
max-height: 100vh;
overflow: hidden;
scrollbar-gutter: stable;
scrollbar-width: none;
}

.sidebar .scrollbar-container:hover {
Expand Down Expand Up @@ -698,7 +699,7 @@ atomic-search-layout atomic-layout-section[section="search"] {

.sidebar .sidebar-navigation ul li .partial {
margin-top: 0;
top: calc(50% - 3.5px);
top: 5px;
left: -13px;
}

Expand All @@ -707,10 +708,7 @@ atomic-search-layout atomic-layout-section[section="search"] {
position: relative;
}

.sidebar
.sidebar-navigation
.parent-collapsible-content
li:not(:only-child)::before {
.sidebar .sidebar-navigation .parent-collapsible-content:first-child::before {
content: "";
position: absolute;
border-left: black 1px solid;
Expand All @@ -719,6 +717,16 @@ atomic-search-layout atomic-layout-section[section="search"] {
height: calc(100% - 9px - 10px);
}

.sidebar
.sidebar-navigation
.parent-collapsible-content
li:not(:only-child)
a
+ :not(:has(#TableOfContents))
li::before {
border: none;
}

/* First Sidebar Nav Horizontal Lines */
.sidebar
.sidebar-navigation
Expand Down Expand Up @@ -748,6 +756,22 @@ atomic-search-layout atomic-layout-section[section="search"] {
align-items: flex-start;
}

/* Table of Contents */
#TableOfContents {
/* Close all TOC on sidebar */
display: none;
}

.collapsible-content li ul li:has(.current) > nav {
/* Open TOC for current page */
display: block !important;
}

#TableOfContents li {
position: relative;
list-style: square;
}

/* content */
main {
flex: 1;
Expand Down
3 changes: 3 additions & 0 deletions layouts/partials/sidebar-list-pages.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<span class="box-link partial"></span>
{{ end }}
<a href="{{ .Permalink }}" style="{{if eq $currentUrl .Permalink}}font-weight: bold;{{end}}">{{ .Title }} </a>
{{- with .TableOfContents -}}
{{- . -}}
{{- end -}}
{{ end }}
</li>
{{ end }}
Expand Down
Loading