amethyst/assets/plugins/_numbered.scss
2023-01-01 23:41:14 +00:00

37 lines
675 B
SCSS

$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 $startLevel through $currentLevel {
$content: $content + 'counter(h#{$n})"."';
}
&::before {
content: unquote($content) " ";
}
}
}
}
.book-toc nav ul {
li {
counter-increment: item;
&:first-child {
counter-reset: item;
}
&:before {
content: counters(item, ".") ". ";
float: left;
margin-inline-end: $padding-4;
}
}
}