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);
|
||||
|
||||
#TableOfContents {
|
||||
ul {
|
||||
ol {
|
||||
counter-reset: item;
|
||||
list-style-type: none;
|
||||
counter-reset: section;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
& > ul {
|
||||
& > li {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
@ -211,13 +213,13 @@
|
||||
padding: 5px;
|
||||
|
||||
&::before {
|
||||
counter-increment: section;
|
||||
content: counters(section, ".") ". ";
|
||||
counter-increment: item;
|
||||
content: counters(item, ".") ". ";
|
||||
font-weight: bold;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
& > ul {
|
||||
& > ol {
|
||||
margin-top: 10px;
|
||||
padding-left: 10px;
|
||||
margin-bottom: -5px;
|
||||
|
@ -42,7 +42,7 @@ params:
|
||||
|
||||
article:
|
||||
math: false
|
||||
toc: true
|
||||
toc: false
|
||||
license:
|
||||
enabled: true
|
||||
default: Licensed under CC BY-NC-SA 4.0
|
||||
@ -146,5 +146,9 @@ related:
|
||||
weight: 200
|
||||
|
||||
markup:
|
||||
tableOfContents:
|
||||
endLevel: 4
|
||||
ordered: true
|
||||
startLevel: 2
|
||||
highlight:
|
||||
noClasses: false
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{ 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) -}}
|
||||
article-page keep-sidebar{{ if (.Scratch.Get "hasTOC") }} has-toc{{ end }}
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user