First idea to add inline toc

This commit is contained in:
Mikołaj Dalecki 2022-05-18 23:06:12 +02:00 committed by MikDal002
parent 0a5cbea10f
commit 9fb507a6ff
4 changed files with 27 additions and 1 deletions

View File

@ -10,7 +10,7 @@
max-width: var(--right-sidebar-max-width);
/// Display right sidebar when min-width: lg
@include respond(lg) {
@include respond(xl) {
display: flex;
}
}

View File

@ -373,6 +373,21 @@
}
}
.toc--inline {
background-color: rgb(241, 241, 241);
margin-left: calc((var(--card-padding)) * -1);
margin-right: calc((var(--card-padding)) * -1);
padding-left: var(--card-padding);
padding-right: var(--card-padding);
padding-top: var(--card-padding);
padding-bottom: var(--card-padding);
@include respond(xl) {
display: none;
}
}
/// Negative margins
blockquote,
figure,

View File

@ -1,4 +1,6 @@
<section class="article-content">
{{ partial "article/components/toc-inline" . }}
<!-- Refer to https://discourse.gohugo.io/t/responsive-tables-in-markdown/10639/5 -->
{{ $wrappedTable := printf "<div class=\"table-wrapper\">${1}</div>" }}
{{ .Content | replaceRE "(<table>(?:.|\n)+?</table>)" $wrappedTable | safeHTML }}

View File

@ -0,0 +1,9 @@
{{ if (.Scratch.Get "TOCEnabled") }}
<section class="toc toc--inline">
<h2 class="">{{ T "article.tableOfContents" }}</h2>
<div class="" >
{{ .TableOfContents }}
</div>
</section>
{{ end }}