fix: use <ol> for TOC. And Disable TOC by default for now

This commit is contained in:
Jimmy 2021-06-21 17:41:53 +02:00
parent 85f8577aa2
commit e1c1bef239
3 changed files with 14 additions and 8 deletions

View File

@ -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;

View File

@ -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

View File

@ -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 }}