hugo-book/assets/plugins/_numbered.scss
loikein 15c85acfcd
add number for mobile toc, fix order for nested titles (#555)
Co-authored-by: Alex Shpak <alex-shpak@users.noreply.github.com>
2024-10-04 15:32:07 +02:00

35 lines
674 B
SCSS

$startLevel: 1;
$endLevel: 6;
.book-page .markdown.book-article {
@for $currentLevel from $startLevel through $endLevel {
> h#{$currentLevel} {
counter-increment: h#{$currentLevel};
counter-reset: h#{$currentLevel + 1};
$content: "";
@for $n from $startLevel through $currentLevel {
$content: $content + 'counter(h#{$n})"."';
}
&::before {
content: unquote($content) " ";
}
}
}
}
.book-toc nav#TableOfContents ul {
counter-reset: item;
li {
counter-increment: item;
&:before {
content: counters(item, ".") ". ";
float: left;
margin-inline-end: $padding-4;
}
}
}