💄 Add list number before table of content and article's head outline.

This commit is contained in:
凡梦星尘
2022-09-29 10:24:41 +08:00
parent 70cba4cc6a
commit 28a3d36f88
17 changed files with 131 additions and 107 deletions

View File

@@ -42,6 +42,32 @@
}
}
.autonumber {
h2 {
counter-reset: h3;
&:before{
counter-increment: h2;
content: counter(h2) ". ";
}
}
h3 {
counter-reset: h4;
&:before{
counter-increment: h3;
content: counter(h2) ". " counter(h3) ". ";
}
}
h4 {
counter-reset: h5;
&:before{
counter-increment: h4;
content: counter(h2) "." counter(h3) "." counter(h4) ". ";
}
}
}
@import 'post-collapse';
@import 'post-body';
@import 'post-gallery';

View File

@@ -1,62 +1,67 @@
@if $toc_enable {
.post-toc {
font-size: $font-size-small;
padding: 0 8px;
ul {
list-style: none;
margin: 0;
padding: 0 2px 5px 10px;
text-align: left;
.post-toc {
font-size: $font-size-small;
padding: 0 8px;
ul {
list-style: none;
margin: 0;
padding: 0 2px 5px 10px;
text-align: left;
counter-reset: item;
> li {
padding-left: 0;
> li {
padding-left: 0;
}
a {
transition: all $transition-ease;
&:before {
content: counters(item, ".") ". ";
counter-increment: item;
}
}
}
a {
transition: all $transition-ease;
.nav-item {
line-height: 1.8;
overflow: hidden;
text-overflow: ellipsis;
@if not $toc_wrap {
white-space: nowrap;
}
}
.nav {
.nav-child {
display: if($toc_expand_all, block, none);
}
.active > .nav-child {
display: block;
}
.active-current > .nav-child {
display: block;
> .nav-item {
display: block;
}
}
.nav-item {
line-height: 1.8;
overflow: hidden;
text-overflow: ellipsis;
@if not $toc_wrap {
white-space: nowrap;
}
.active > a {
border-bottom-color: $sidebar-highlight;
color: $sidebar-highlight;
}
.nav {
.nav-child {
display: if($toc_expand_all, block, none);
}
.active-current > a {
color: $sidebar-highlight;
.active > .nav-child {
display: block;
}
.active-current > .nav-child {
display: block;
> .nav-item {
display: block;
}
}
.active > a {
border-bottom-color: $sidebar-highlight;
&:hover {
color: $sidebar-highlight;
}
.active-current > a {
color: $sidebar-highlight;
&:hover {
color: $sidebar-highlight;
}
}
}
}
}

View File

@@ -17,6 +17,7 @@ html {
*/
body {
margin: 0;
counter-reset: h2;
}
/**