#196, #201 Refactor numbered plugin. multilevel numbers in ToC

pull/219/head
Alex Shpak 2020-04-21 23:25:36 +02:00
parent 66968582ef
commit 357de9eb39
1 changed files with 28 additions and 15 deletions

View File

@ -1,12 +1,14 @@
.book-page {
.markdown {
@for $h from 1 through 6 {
> h#{$h} {
counter-increment: h#{$h};
counter-reset: h#{$h + 1};
$startLevel: 1;
$endLevel: 6;
.book-page .markdown {
@for $currentLevel from $startLevel through $endLevel {
> h#{$currentLevel} {
counter-increment: h#{$currentLevel};
counter-reset: h#{$currentLevel + 1};
$content: "";
@for $n from 1 through $h {
@for $n from $startLevel through $currentLevel {
$content: $content + 'counter(h#{$n})"."';
}
@ -17,7 +19,18 @@
}
}
+ .book-toc nav ul {
list-style: decimal;
.book-toc nav ul {
li {
counter-increment: item;
&:first-child {
counter-reset: item;
}
&:before {
content: counters(item, ".") ". ";
float: left;
margin-right: $padding-4;
}
}
}