Add before and after partials for toc (#296)

Closes #257
soper-book
Tiger Oakes 2021-01-26 09:45:08 -08:00 committed by GitHub
parent a12baf0e01
commit 012ccee53d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 19 deletions

View File

@ -235,7 +235,7 @@ bookSearchExclude = true
There are few empty partials you can override in `layouts/partials/`
| Partial | Placement |
| -------------------------------------------------- | -------------------------------------- |
| -------------------------------------------------- | ------------------------------------------- |
| `layouts/partials/docs/inject/head.html` | Before closing `<head>` tag |
| `layouts/partials/docs/inject/body.html` | Before closing `<body>` tag |
| `layouts/partials/docs/inject/footer.html` | After page footer content |
@ -243,6 +243,8 @@ There are few empty partials you can override in `layouts/partials/`
| `layouts/partials/docs/inject/menu-after.html` | At the end of `<nav>` menu block |
| `layouts/partials/docs/inject/content-before.html` | Before page content |
| `layouts/partials/docs/inject/content-after.html` | After page content |
| `layouts/partials/docs/inject/toc-before.html` | At the beginning of table of contents block |
| `layouts/partials/docs/inject/toc-after.html` | At the end of table of contents block |
### Extra Customisation

View File

@ -209,7 +209,7 @@ ul.pagination {
flex: 0 0 $toc-width;
font-size: $font-size-12;
nav {
> nav {
width: $toc-width;
padding: $padding-16;
@ -377,7 +377,7 @@ aside nav,
@media screen and (min-width: $container-max-width) {
.book-page,
.book-menu nav,
.book-toc nav {
.book-toc > nav {
padding: $padding-16 * 2 $padding-16;
}
}

View File

@ -1 +1 @@
{"Target":"book.min.134b70e5316650a530cb42e4e8630b2a01d532bebfc0337028211175336e4806.css","MediaType":"text/css","Data":{"Integrity":"sha256-E0tw5TFmUKUwy0Lk6GMLKgHVMr6/wDNwKCERdTNuSAY="}}
{"Target":"book.min.5284606b3d4d63899357ff95f4032c205e62b86963d9241c255c46093296e5a0.css","MediaType":"text/css","Data":{"Integrity":"sha256-UoRgaz1NY4mTV/+V9AMsIF5iuGlj2SQcJVxGCTKW5aA="}}

View File

@ -36,7 +36,11 @@
{{ if default true (default .Site.Params.BookToC .Params.BookToC) }}
<aside class="book-toc">
<nav>
{{ partial "docs/inject/toc-before" . }}
{{ template "toc" . }} <!-- Table of Contents -->
{{ partial "docs/inject/toc-after" . }}
</nav>
</aside>
{{ end }}
</main>