From 007bc10c07d6a6b7cb6c03a138cc90f6f74a3058 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 8 Oct 2019 17:03:40 +0200 Subject: Introduce SCSS plugins: dark mode and numbered headings --- README.md | 76 +++--- assets/_custom.scss | 3 +- assets/_defaults.scss | 50 ++++ assets/_main.scss | 288 ++++++++++++++++++++ assets/_shortcodes.scss | 2 - assets/_variables.scss | 51 +--- assets/book.scss | 302 +-------------------- assets/plugins/_dark.scss | 9 + assets/plugins/_numbered.scss | 23 ++ exampleSite/assets/_custom.scss | 3 +- exampleSite/assets/_variables.scss | 14 +- exampleSite/content/docs/more-examples/advanced.md | 2 +- ...k.scss_48b060fe05b0a273d182ef83c0605941.content | 1 - ...book.scss_48b060fe05b0a273d182ef83c0605941.json | 1 - ...k.scss_50fc8c04e12a2f59027287995557ceff.content | 1 + ...book.scss_50fc8c04e12a2f59027287995557ceff.json | 1 + layouts/partials/docs/html-head.html | 8 +- layouts/partials/docs/menu-bundle.html | 2 +- 18 files changed, 428 insertions(+), 409 deletions(-) create mode 100644 assets/_defaults.scss create mode 100644 assets/_main.scss create mode 100644 assets/plugins/_dark.scss create mode 100644 assets/plugins/_numbered.scss delete mode 100644 exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content delete mode 100644 exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json create mode 100644 exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.content create mode 100644 exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.json diff --git a/README.md b/README.md index 938c5e4..cefaf4c 100644 --- a/README.md +++ b/README.md @@ -125,45 +125,45 @@ enableGitInfo = true # (Optional) Theme is intended for documentation use, therefore it doesn't render taxonomy. # You can remove related files with config below disableKinds = ['taxonomy', 'taxonomyTerm'] - + [params] -# (Optional, default 6) Set how many table of contents levels to be showed on page. -# Use false to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/) -# You can also specify this parameter per page in front matter -BookToC = 3 - -# (Optional, default none) Set the path to a logo for the book. If the logo is -# /static/logo.png then the path would be 'logo.png' -BookLogo = 'logo.png' - -# (Optional, default none) Set leaf bundle to render as side menu -# When not specified file structure and weights will be used -BookMenuBundle = '/menu' - -# (Optional, default docs) Specify section of content to render as menu -# You can also set value to "*" to render all sections to menu -BookSection = 'docs' - -# (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode -# BookMenuBundleActiveLinkColor = '\#05b' - -# Set source repository location. -# Used for 'Last Modified' and 'Edit this page' links. -BookRepo = 'https://github.com/alex-shpak/hugo-book' - -# Enable 'Edit this page' links for 'doc' page type. -# Disabled by default. Uncomment to enable. Requires 'BookRepo' param. -# Path must point to 'content' directory of repo. -BookEditPath = 'edit/master/exampleSite/content' - -# (Optional, default January 2, 2006) Configure the date format used on the pages -# - In git information -# - In blog posts -BookDateFormat = 'Jan 2, 2006' - -# (Optional, default true) Enables search function with lunr.js, -# Index is built on fly, therefore it might slowdown your website. -BookSearch = true + # (Optional, default 6) Set how many table of contents levels to be showed on page. + # Use false to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/) + # You can also specify this parameter per page in front matter + BookToC = 3 + + # (Optional, default none) Set the path to a logo for the book. If the logo is + # /static/logo.png then the path would be 'logo.png' + BookLogo = 'logo.png' + + # (Optional, default none) Set leaf bundle to render as side menu + # When not specified file structure and weights will be used + BookMenuBundle = '/menu' + + # (Optional, default docs) Specify section of content to render as menu + # You can also set value to "*" to render all sections to menu + BookSection = 'docs' + + # (Optional) This value is duplicate of $link-color for making active link highlight in menu bundle mode + # BookMenuBundleActiveLinkColor = '\#05b' + + # Set source repository location. + # Used for 'Last Modified' and 'Edit this page' links. + BookRepo = 'https://github.com/alex-shpak/hugo-book' + + # Enable 'Edit this page' links for 'doc' page type. + # Disabled by default. Uncomment to enable. Requires 'BookRepo' param. + # Path must point to 'content' directory of repo. + BookEditPath = 'edit/master/exampleSite/content' + + # (Optional, default January 2, 2006) Configure the date format used on the pages + # - In git information + # - In blog posts + BookDateFormat = 'Jan 2, 2006' + + # (Optional, default true) Enables search function with lunr.js, + # Index is built on fly, therefore it might slowdown your website. + BookSearch = true ``` ### Page Configuration diff --git a/assets/_custom.scss b/assets/_custom.scss index 181c87c..75c4833 100644 --- a/assets/_custom.scss +++ b/assets/_custom.scss @@ -1,2 +1 @@ -/* To be overridden by theme user */ -// @import "variables"; +/* To be overridden by theme user, scss variables are also accessible here */ diff --git a/assets/_defaults.scss b/assets/_defaults.scss new file mode 100644 index 0000000..b11c9a9 --- /dev/null +++ b/assets/_defaults.scss @@ -0,0 +1,50 @@ +// Used in layout +$padding-1: 1px !default; +$padding-4: 0.25rem !default; +$padding-8: 0.5rem !default; +$padding-16: 1rem !default; + +$font-size-base: 16px !default; +$font-size-12: 0.75rem !default; +$font-size-14: 0.875rem !default; +$font-size-16: 1rem !default; + +$border-radius: 0.15rem !default; + +// Grayscale +$white: #ffffff !default; +$gray-100: #f8f9fa !default; +$gray-200: #e9ecef !default; +$gray-300: #dee2e6 !default; +$gray-400: #ced4da !default; +$gray-500: #adb5bd !default; +$gray-600: #868e96 !default; +$gray-700: #495057 !default; +$gray-800: #343a40 !default; +$gray-900: #212529 !default; +$black: #000 !default; + +$color-link: #05b !default; +$color-visited-link: #8440f1 !default; +$color-dark-link: $gray-800 !default; + +$body-background: white !default; +$body-font-color: $gray-800 !default; +$body-font-weight: normal !default; + +$body-min-width: 20rem !default; +$container-max-width: 80rem !default; + +$header-height: 3.5rem !default; +$menu-width: 16rem !default; +$toc-width: 16rem !default; + +$md-breakpoint: $menu-width + $body-min-width * 1.25 + $toc-width !default; +$sm-breakpoint: $menu-width + $body-min-width !default; + +// Panel colors +$hint-colors: ( + info: #6bf, + warning: #fd6, + danger: #f66 +) !default; diff --git a/assets/_main.scss b/assets/_main.scss new file mode 100644 index 0000000..7fb47c4 --- /dev/null +++ b/assets/_main.scss @@ -0,0 +1,288 @@ +html { + font-size: $font-size-base; + letter-spacing: 0.33px; + scroll-behavior: smooth; +} + +html, +body { + min-width: $body-min-width; + overflow-x: hidden; +} + +body { + color: $body-font-color; + background: $body-background; + + font-weight: $body-font-weight; + + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + box-sizing: border-box; + * { + box-sizing: inherit; + } +} + +h1, +h2, +h3, +h4, +h5 { + font-weight: $body-font-weight; +} + +a { + text-decoration: none; + color: $color-link; + + &:visited { + color: $color-visited-link; + } +} + +img { + vertical-align: baseline; +} + +aside nav ul { + padding: 0; + margin: 0; + list-style: none; + + li { + margin: 1em 0; + } + + a { + display: block; + } + + a:hover { + opacity: 0.5; + } + + ul { + padding-left: $padding-16; + } +} + +ul.pagination { + display: flex; + justify-content: center; + list-style-type: none; + + .page-item a { + padding: $padding-16; + } +} + +.container { + max-width: $container-max-width; + margin: 0 auto; +} + +.book-brand { + margin-top: 0; + + img { + height: 1.5em; + width: auto; + vertical-align: middle; + margin-right: $padding-8; + } +} + +.book-menu { + flex: 0 0 $menu-width; + font-size: $font-size-14; + + nav { + width: $menu-width; + padding: $padding-16; + + @include fixed; + } + + @include dark-links; +} + +.book-section-flat { + margin-bottom: $padding-16 * 2; + + &:not(:first-child) { + margin-top: $padding-16 * 2; + } + + > a, + > span { + font-weight: bolder; + } + + > ul { + padding-left: 0; + } +} + +.book-page { + min-width: $body-min-width; + flex-grow: 1; + padding: $padding-16; +} + +.book-header { + margin-bottom: $padding-16; + display: none; +} + +.book-search { + position: relative; + margin: $padding-16 0; + border-bottom: 1px solid transparent; + + &::after { + display: block; + content: ""; + clear: both; + } + + input { + width: 100%; + padding: $padding-8; + + border: 0; + border-radius: $padding-4; + + background: $gray-100; + + &:required + .book-search-spinner { + display: block; + } + } + + .book-search-spinner { + position: absolute; + margin: $padding-8; + right: 0; + top: 0; + + width: $padding-16; + height: $padding-16; + + border: $padding-1 solid transparent; + border-top-color: $body-font-color; + border-radius: 50%; + + @include spin(1s); + } +} + +.book-toc { + flex: 0 0 $toc-width; + font-size: $font-size-12; + + nav { + width: $toc-width; + padding: $padding-16; + + @include fixed; + } + + img { + height: 1em; + } + + nav > ul > li:first-child { + margin-top: 0; + } + + // Classes to hide nested levels of ToC (can be replaced by @for, but it's more clear like this) + &.level-1 ul ul, + &.level-2 ul ul ul, + &.level-3 ul ul ul ul, + &.level-4 ul ul ul ul ul, + &.level-5 ul ul ul ul ul ul, + &.level-6 ul ul ul ul ul ul ul { + display: none; + } +} + +.book-footer { + display: flex; + padding-top: $padding-16; + font-size: $font-size-14; + + img { + height: 1em; + } +} + +.book-posts { + min-width: $body-min-width; + max-width: $body-min-width * 2; + flex-grow: 1; + padding: $padding-16; + + article { + padding-bottom: $padding-16; + } +} + +.book-home { + padding: $padding-16; +} + +// Responsive styles +aside nav, +.book-page, +.book-posts, +.markdown { + transition: 0.2s ease-in-out; + transition-property: transform, margin-left, opacity; + will-change: transform, margin-left; +} + +@media screen and (max-width: $md-breakpoint) { + .book-toc { + display: none; + } +} + +@media screen and (max-width: $sm-breakpoint) { + .book-menu { + margin-left: -$menu-width; + font-size: $font-size-base; + } + + .book-header { + display: flex; + } + + #menu-control:checked + main { + .book-menu nav, + .book-page, + .book-posts { + transform: translateX($menu-width); + } + + .book-header label { + transform: rotate(90deg); + } + + .markdown { + opacity: 0.25; + } + } +} + +// Extra space for big screens +@media screen and (min-width: $container-max-width) { + .book-page, + .book-posts, + .book-menu nav, + .book-toc nav { + padding: $padding-16 * 2 $padding-16; + } +} diff --git a/assets/_shortcodes.scss b/assets/_shortcodes.scss index bc0916c..451f8b8 100644 --- a/assets/_shortcodes.scss +++ b/assets/_shortcodes.scss @@ -1,5 +1,3 @@ -@import "variables"; - .markdown-inner { // Util class to remove extra margin in nested markdown content > :first-child { diff --git a/assets/_variables.scss b/assets/_variables.scss index 6eb8e4c..5cbcc8c 100644 --- a/assets/_variables.scss +++ b/assets/_variables.scss @@ -1,50 +1 @@ -// Used in layout -$padding-1: 1px !default; -$padding-4: 0.25rem !default; -$padding-8: 0.5rem !default; -$padding-16: 1rem !default; - -$font-size-base: 16px !default; -$font-size-12: 0.75rem !default; -$font-size-14: 0.875rem !default; -$font-size-16: 1rem !default; - -$border-radius: 0.15rem !default; - -// Grayscale -$white: #ffffff !default; -$gray-100: #f8f9fa !default; -$gray-200: #e9ecef !default; -$gray-300: #dee2e6 !default; -$gray-400: #ced4da !default; -$gray-500: #adb5bd !default; -$gray-600: #868e96 !default; -$gray-700: #495057 !default; -$gray-800: #343a40 !default; -$gray-900: #212529 !default; -$black: #000 !default; - -$color-link: #05b !default; -$color-visited-link: #8440f1 !default; -$color-dark-link: $gray-800 !default; - -$body-background: white !default; -$body-font-color: $gray-800 !default; -$body-font-weight: normal !default; - -$body-min-width: 20rem !default; -$container-max-width: 80rem !default; - -$header-height: 3.5rem !default; -$menu-width: 16rem !default; -$toc-width: 16rem !default; - -$md-breakpoint: $menu-width + $body-min-width * 1.25 + $toc-width !default; -$sm-breakpoint: $menu-width + $body-min-width !default; - -// Panel colors -$hint-colors: ( - info: #6bf, - warning: #fd6, - danger: #f66 -); +/* To be overridden by theme user, e.g. set SASS vars*/ diff --git a/assets/book.scss b/assets/book.scss index 2a7379f..529c908 100644 --- a/assets/book.scss +++ b/assets/book.scss @@ -1,301 +1,13 @@ -@import "normalize"; +@import "defaults"; @import "variables"; + +@import "normalize"; @import "utils"; +@import "main"; +@import "fonts"; + @import "markdown"; @import "shortcodes"; -html { - font-size: $font-size-base; - letter-spacing: 0.33px; - scroll-behavior: smooth; -} - -html, -body { - min-width: $body-min-width; - overflow-x: hidden; -} - -body { - color: $body-font-color; - background: $body-background; - - font-family: sans-serif; - font-weight: $body-font-weight; - - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - - box-sizing: border-box; - * { - box-sizing: inherit; - } -} - -h1, -h2, -h3, -h4, -h5 { - font-weight: $body-font-weight; -} - -a { - text-decoration: none; - color: $color-link; - - &:visited { - color: $color-visited-link; - } -} - -img { - vertical-align: baseline; -} - -aside nav ul { - padding: 0; - margin: 0; - list-style: none; - - li { - margin: 1em 0; - } - - a { - display: block; - } - - a:hover { - opacity: 0.5; - } - - ul { - padding-left: $padding-16; - } -} - -ul.pagination { - display: flex; - justify-content: center; - list-style-type: none; - - .page-item a { - padding: $padding-16; - } -} - -.container { - max-width: $container-max-width; - margin: 0 auto; -} - -.book-brand { - margin-top: 0; - - img { - height: 1.5em; - width: auto; - vertical-align: middle; - margin-right: $padding-8; - } -} - -.book-menu { - flex: 0 0 $menu-width; - font-size: $font-size-14; - - nav { - width: $menu-width; - padding: $padding-16; - - @include fixed; - } - - @include dark-links; -} - -.book-section-flat { - margin-bottom: $padding-16 * 2; - - &:not(:first-child) { - margin-top: $padding-16 * 2; - } - - > a, - > span { - font-weight: bolder; - } - - > ul { - padding-left: 0; - } -} - -.book-page { - min-width: $body-min-width; - flex-grow: 1; - padding: $padding-16; -} - -.book-header { - margin-bottom: $padding-16; - display: none; -} - -.book-search { - position: relative; - margin: $padding-16 0; - border-bottom: 1px solid transparent; - - &::after { - display: block; - content: ""; - clear: both; - } - - input { - width: 100%; - padding: $padding-8; - - border: 0; - border-radius: $padding-4; - - background: $gray-100; - - &:required + .book-search-spinner { - display: block; - } - } - - .book-search-spinner { - position: absolute; - margin: $padding-8; - right: 0; - top: 0; - - width: $padding-16; - height: $padding-16; - - border: $padding-1 solid transparent; - border-top-color: $body-font-color; - border-radius: 50%; - - @include spin(1s); - } -} - -.book-toc { - flex: 0 0 $toc-width; - font-size: $font-size-12; - - nav { - width: $toc-width; - padding: $padding-16; - - @include fixed; - } - - img { - height: 1em; - } - - nav > ul > li:first-child { - margin-top: 0; - } - - // Classes to hide nested levels of ToC (can be replaced by @for, but it's more clear like this) - &.level-1 ul ul, - &.level-2 ul ul ul, - &.level-3 ul ul ul ul, - &.level-4 ul ul ul ul ul, - &.level-5 ul ul ul ul ul ul, - &.level-6 ul ul ul ul ul ul ul { - display: none; - } -} - -.book-footer { - display: flex; - padding-top: $padding-16; - font-size: $font-size-14; - - img { - height: 1em; - } -} - -.book-posts { - min-width: $body-min-width; - max-width: $body-min-width * 2; - flex-grow: 1; - padding: $padding-16; - - article { - padding-bottom: $padding-16; - } -} - -.book-home { - padding: $padding-16; -} - -// Responsive styles -aside nav, -.book-page, -.book-posts, -.markdown { - transition: 0.2s ease-in-out; - transition-property: transform, margin-left, opacity; - will-change: transform, margin-left; -} - -@media screen and (max-width: $md-breakpoint) { - .book-toc { - display: none; - } -} - -@media screen and (max-width: $sm-breakpoint) { - .book-menu { - margin-left: -$menu-width; - font-size: $font-size-base; - } - - .book-header { - display: flex; - } - - #menu-control:checked + main { - .book-menu nav, - .book-page, - .book-posts { - transform: translateX($menu-width); - } - - .book-header label { - transform: rotate(90deg); - } - - .markdown { - opacity: 0.25; - } - } -} - -// Extra space for big screens -@media screen and (min-width: $container-max-width) { - .book-page, - .book-posts, - .book-menu nav, - .book-toc nav { - padding: $padding-16 * 2 $padding-16; - } -} - -// Add fonts -@import "fonts"; - -// Add custom defined styles +// Custom defined styles @import "custom"; diff --git a/assets/plugins/_dark.scss b/assets/plugins/_dark.scss new file mode 100644 index 0000000..c4df68b --- /dev/null +++ b/assets/plugins/_dark.scss @@ -0,0 +1,9 @@ +$gray-100: rgba(255, 255, 255, 0.1); +$gray-200: rgba(255, 255, 255, 0.2); + +$body-background: #343a40; +$body-font-color: #e9ecef; + +$color-link: #84b2ff; +$color-visited-link: #b88dff; +$color-dark-link: $body-font-color; diff --git a/assets/plugins/_numbered.scss b/assets/plugins/_numbered.scss new file mode 100644 index 0000000..a1e89d8 --- /dev/null +++ b/assets/plugins/_numbered.scss @@ -0,0 +1,23 @@ +.book-page { + .markdown { + @for $h from 1 through 6 { + > h#{$h} { + counter-increment: h#{$h}; + counter-reset: h#{$h + 1}; + + $content: ""; + @for $n from 1 through $h { + $content: $content + 'counter(h#{$n})"."'; + } + + &::before { + content: unquote($content) " "; + } + } + } + } + + + .book-toc nav ul { + list-style: decimal; + } +} diff --git a/exampleSite/assets/_custom.scss b/exampleSite/assets/_custom.scss index cdb82f7..38b16a2 100644 --- a/exampleSite/assets/_custom.scss +++ b/exampleSite/assets/_custom.scss @@ -1,2 +1,3 @@ -@import "variables"; // You can add custom styles here. + +// @import "plugins/numbered"; diff --git a/exampleSite/assets/_variables.scss b/exampleSite/assets/_variables.scss index ec7bff2..431dabc 100644 --- a/exampleSite/assets/_variables.scss +++ b/exampleSite/assets/_variables.scss @@ -1,13 +1,3 @@ -// You can override SASS variables here. Below example of simple dark theme. +/* You can override SASS variables here. Below example of simple dark theme. */ -/* -$gray-100: rgba(255, 255, 255, 0.1); -$gray-200: rgba(255, 255, 255, 0.2); - -$body-background: #343a40; -$body-font-color: #e9ecef; - -$color-link: #84b2ff; -$color-visited-link: #b88dff; -$color-dark-link: $body-font-color; -*/ +// @import "plugins/dark"; diff --git a/exampleSite/content/docs/more-examples/advanced.md b/exampleSite/content/docs/more-examples/advanced.md index 595b1d6..ca3dcf1 100644 --- a/exampleSite/content/docs/more-examples/advanced.md +++ b/exampleSite/content/docs/more-examples/advanced.md @@ -49,4 +49,4 @@ nec, nate, ignari, vernum cohaesit sequitur. Vel **mitis temploque** vocatus, inque alis, *oculos nomen* non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem -Propoetides **parte**. \ No newline at end of file +Propoetides **parte**. diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content deleted file mode 100644 index 1b5ddd0..0000000 --- a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content +++ /dev/null @@ -1 +0,0 @@ -/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.hidden{display:none}.markdown{line-height:1.6}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1;margin-top:1.5em;margin-bottom:1rem}.markdown>:first-child{margin-top:0}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown img{max-width:100%}.markdown code{padding:0 .25rem;background:#e9ecef;border-radius:.15rem;font-size:.875em}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{margin:1rem 0;padding:.5rem 1rem .5rem .75rem;border-left:.25rem solid #e9ecef;border-radius:.15rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{overflow:auto;display:block;border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown ul,.markdown ol{padding-left:2rem}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-left:2rem}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #05b}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns{margin-left:-1rem;margin-right:-1rem}.book-columns>div{margin:1rem 0;min-width:13.2rem;padding:0 1rem}a.book-btn{display:inline-block;color:#05b!important;text-decoration:none!important;border:1px solid #05b;border-radius:.15rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}.book-hint.info{border-left-color:#6bf;background-color:rgba(102,187,255,.1)}.book-hint.warning{border-left-color:#fd6;background-color:rgba(255,221,102,.1)}.book-hint.danger{border-left-color:#f66;background-color:rgba(255,102,102,.1)}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#05b}a:visited{color:#8440f1}img{vertical-align:baseline}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center;list-style-type:none}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-brand img{height:1.5em;width:auto;vertical-align:middle;margin-right:.5rem}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#05b}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-search{position:relative;margin:1rem 0;border-bottom:1px solid transparent}.book-search::after{display:block;content:"";clear:both}.book-search input{width:100%;padding:.5rem;border:0;border-radius:.25rem;background:#f8f9fa}.book-search input:required+.book-search-spinner{display:block}.book-search .book-search-spinner{position:absolute;margin:.5rem;right:0;top:0;width:1rem;height:1rem;border:1px solid transparent;border-top-color:#343a40;border-radius:50%;animation:spin 1s ease infinite}@keyframes spin{100%{transform:rotate(360deg)}}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-toc.level-1 ul ul,.book-toc.level-2 ul ul ul,.book-toc.level-3 ul ul ul ul,.book-toc.level-4 ul ul ul ul ul,.book-toc.level-5 ul ul ul ul ul ul,.book-toc.level-6 ul ul ul ul ul ul ul{display:none}.book-footer{display:flex;padding-top:1rem;font-size:.875rem}.book-footer img{height:1em}.book-posts{min-width:20rem;max-width:40rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:57rem){.book-toc{display:none}}@media screen and (max-width:36rem){.book-menu{margin-left:-16rem;font-size:16px}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace} \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json deleted file mode 100644 index 858f5e7..0000000 --- a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json +++ /dev/null @@ -1 +0,0 @@ -{"Target":"book.min.e2750c58bf0545d36d2426996f9d6108a275d000f33e7552d83ea28bdcd34ab7.css","MediaType":"text/css","Data":{"Integrity":"sha256-4nUMWL8FRdNtJCaZb51hCKJ10ADzPnVS2D6ii9zTSrc="}} \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.content b/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.content new file mode 100644 index 0000000..815ce83 --- /dev/null +++ b/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.content @@ -0,0 +1 @@ +/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.hidden{display:none}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#05b}a:visited{color:#8440f1}img{vertical-align:baseline}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center;list-style-type:none}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-brand img{height:1.5em;width:auto;vertical-align:middle;margin-right:.5rem}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#05b}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-search{position:relative;margin:1rem 0;border-bottom:1px solid transparent}.book-search::after{display:block;content:"";clear:both}.book-search input{width:100%;padding:.5rem;border:0;border-radius:.25rem;background:#f8f9fa}.book-search input:required+.book-search-spinner{display:block}.book-search .book-search-spinner{position:absolute;margin:.5rem;right:0;top:0;width:1rem;height:1rem;border:1px solid transparent;border-top-color:#343a40;border-radius:50%;animation:spin 1s ease infinite}@keyframes spin{100%{transform:rotate(360deg)}}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-toc.level-1 ul ul,.book-toc.level-2 ul ul ul,.book-toc.level-3 ul ul ul ul,.book-toc.level-4 ul ul ul ul ul,.book-toc.level-5 ul ul ul ul ul ul,.book-toc.level-6 ul ul ul ul ul ul ul{display:none}.book-footer{display:flex;padding-top:1rem;font-size:.875rem}.book-footer img{height:1em}.book-posts{min-width:20rem;max-width:40rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:57rem){.book-toc{display:none}}@media screen and (max-width:36rem){.book-menu{margin-left:-16rem;font-size:16px}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace}.markdown{line-height:1.6}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1;margin-top:1.5em;margin-bottom:1rem}.markdown>:first-child{margin-top:0}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown img{max-width:100%}.markdown code{padding:0 .25rem;background:#e9ecef;border-radius:.15rem;font-size:.875em}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{margin:1rem 0;padding:.5rem 1rem .5rem .75rem;border-left:.25rem solid #e9ecef;border-radius:.15rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{overflow:auto;display:block;border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown ul,.markdown ol{padding-left:2rem}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-left:2rem}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #05b}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns{margin-left:-1rem;margin-right:-1rem}.book-columns>div{margin:1rem 0;min-width:13.2rem;padding:0 1rem}a.book-btn{display:inline-block;color:#05b!important;text-decoration:none!important;border:1px solid #05b;border-radius:.15rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}.book-hint.info{border-left-color:#6bf;background-color:rgba(102,187,255,.1)}.book-hint.warning{border-left-color:#fd6;background-color:rgba(255,221,102,.1)}.book-hint.danger{border-left-color:#f66;background-color:rgba(255,102,102,.1)} \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.json b/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.json new file mode 100644 index 0000000..cd992f9 --- /dev/null +++ b/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.json @@ -0,0 +1 @@ +{"Target":"book.min.4e5c3d92718456dab80c87ced0c4c63d3984fb3a742f718957ca25c01c6dcdb6.css","MediaType":"text/css","Data":{"Integrity":"sha256-Tlw9knGEVtq4DIfO0MTGPTmE+zp0L3GJV8olwBxtzbY="}} \ No newline at end of file diff --git a/layouts/partials/docs/html-head.html b/layouts/partials/docs/html-head.html index 599695b..28815a1 100644 --- a/layouts/partials/docs/html-head.html +++ b/layouts/partials/docs/html-head.html @@ -3,9 +3,10 @@ {{- template "_internal/opengraph.html" . -}} {{ partial "docs/title" . }} | {{ .Site.Title -}} + -{{- $styles := resources.Get "book.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} +{{- $styles := resources.Get "book.scss" | resources.ExecuteAsTemplate "book.scss" . | resources.ToCSS | resources.Minify | resources.Fingerprint }} {{ if default true .Site.Params.BookSearch }} @@ -13,8 +14,7 @@ {{ end }} - - +{{- template "_internal/google_analytics_async.html" . -}} {{ with .OutputFormats.Get "rss" -}} @@ -25,5 +25,3 @@ Made with Book Theme https://github.com/alex-shpak/hugo-book {{ "-->" | safeHTML }} - -{{ template "_internal/google_analytics_async.html" . }} diff --git a/layouts/partials/docs/menu-bundle.html b/layouts/partials/docs/menu-bundle.html index 2aedb54..eced12e 100644 --- a/layouts/partials/docs/menu-bundle.html +++ b/layouts/partials/docs/menu-bundle.html @@ -13,7 +13,7 @@ {{ end }} -- cgit v1.2.3