mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
fix: use <ol> for TOC. And Disable TOC by default for now
This commit is contained in:
parent
85f8577aa2
commit
e1c1bef239
@ -196,12 +196,14 @@
|
|||||||
color: var(--card-text-color-main);
|
color: var(--card-text-color-main);
|
||||||
|
|
||||||
#TableOfContents {
|
#TableOfContents {
|
||||||
ul {
|
ol {
|
||||||
|
counter-reset: item;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
counter-reset: section;
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > ul {
|
& > li {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@ -211,13 +213,13 @@
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
counter-increment: section;
|
counter-increment: item;
|
||||||
content: counters(section, ".") ". ";
|
content: counters(item, ".") ". ";
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > ul {
|
& > ol {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
margin-bottom: -5px;
|
margin-bottom: -5px;
|
||||||
|
@ -42,7 +42,7 @@ params:
|
|||||||
|
|
||||||
article:
|
article:
|
||||||
math: false
|
math: false
|
||||||
toc: true
|
toc: false
|
||||||
license:
|
license:
|
||||||
enabled: true
|
enabled: true
|
||||||
default: Licensed under CC BY-NC-SA 4.0
|
default: Licensed under CC BY-NC-SA 4.0
|
||||||
@ -146,5 +146,9 @@ related:
|
|||||||
weight: 200
|
weight: 200
|
||||||
|
|
||||||
markup:
|
markup:
|
||||||
|
tableOfContents:
|
||||||
|
endLevel: 4
|
||||||
|
ordered: true
|
||||||
|
startLevel: 2
|
||||||
highlight:
|
highlight:
|
||||||
noClasses: false
|
noClasses: false
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ define "body-class" }}
|
{{ define "body-class" }}
|
||||||
{{ $TOCEnabled := default (default true .Site.Params.article.toc) .Params.toc }}
|
{{ $TOCEnabled := default (default false .Site.Params.article.toc) .Params.toc }}
|
||||||
{{- .Scratch.Set "hasTOC" (and (ge (len .TableOfContents) 100) $TOCEnabled) -}}
|
{{- .Scratch.Set "hasTOC" (and (ge (len .TableOfContents) 100) $TOCEnabled) -}}
|
||||||
article-page keep-sidebar{{ if (.Scratch.Get "hasTOC") }} has-toc{{ end }}
|
article-page keep-sidebar{{ if (.Scratch.Get "hasTOC") }} has-toc{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user