diff --git a/assets/_defaults.scss b/assets/_defaults.scss index 0a3c528..f0af2c1 100644 --- a/assets/_defaults.scss +++ b/assets/_defaults.scss @@ -28,9 +28,9 @@ $hint-colors: ( warning: #f59e42, danger: #d84747, - note: #64748b, + note: #4486dd, tip: #3bad3b, - important: #4486dd, + important: #8144dd, caution: #d84747 ) !default; diff --git a/assets/_main.scss b/assets/_main.scss index 923cec9..985b92d 100644 --- a/assets/_main.scss +++ b/assets/_main.scss @@ -217,6 +217,22 @@ body[dir="rtl"] .book-menu { height: 1.5em; width: 1.5em; } + + > ul { + margin: 0; + padding: 0 $padding-16; + display: flex; + gap: $padding-16; + justify-content: end; + + li { + display: inline-block; + } + } +} + +.book-kind-home .book-header { + display: block; } .book-search { @@ -338,7 +354,7 @@ body[dir="rtl"] .book-menu { } .book-header { - display: block; + display: block !important; } #menu-control:focus ~ main label[for="menu-control"] { diff --git a/assets/_shortcodes.scss b/assets/_shortcodes.scss index 2ee08bb..b6d9064 100644 --- a/assets/_shortcodes.scss +++ b/assets/_shortcodes.scss @@ -132,17 +132,17 @@ } span.book-badge-title { - background-color: var(--body-background); - opacity: 0.9; + --background-opacity: 0.1; } span.book-badge-value { + --background-opacity: 1; color: var(--body-background); } @each $name, $color in $hint-colors { - &.#{$name} { - background-color: $color; + &.#{$name} span { + background-color: rgba($color, var(--background-opacity)); } } } @@ -192,4 +192,41 @@ } } } + + // {{< card >}} + .book-card { + display: block; + overflow: hidden; + height: 100%; + border-radius: $border-radius; + border: $padding-1 solid var(--gray-200); + + &[href]:hover { + text-decoration: none; + background: var(--gray-100); + } + &[href]:visited { + color: var(--body-font-color); + } + + img { + display: block; + object-fit: contain; + aspect-ratio: 4 / 3; + object-fit: cover; + } + + .markdown-inner { + padding: $padding-16; + } + } + + .book-hero { + min-height: $padding-16 * 24; + align-content: center; + + h1 { + font-size: 3em; + } + } } \ No newline at end of file diff --git a/exampleSite/content.en/_index.md b/exampleSite/content.en/_index.md index c2988db..407701a 100644 --- a/exampleSite/content.en/_index.md +++ b/exampleSite/content.en/_index.md @@ -1,41 +1,62 @@ --- title: Introduction -type: docs +bookHeadingAnchor: false --- -# Acerbo datus maxime +
+ +# HUGO BOOK +[Hugo](https://gohugo.io) documentation theme as simple as plain book + +{{< badge style="info" title="Badge" value="Value" >}} {{< badge style="default" title="Badge" value="Value" >}} + +{{}} + +
{{% columns %}} -## Astris ipse furtiva +- ## Astris ipse furtiva + Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut + olivae sensit **arma sorori** deducit, inesset **crudus**, ego vetuere aliis, + modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies -Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut -olivae sensit **arma sorori** deducit, inesset **crudus**, ego vetuere aliis, -modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies - -<---> - -## Suis quot vota - -Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat: -miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod -nunc! Fragosis suae dextra geruntur functus vulgata. +- ## Suis quot vota + Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat: + miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod + nunc! Fragosis suae dextra geruntur functus vulgata. {{% /columns %}} -## Tempora nisi nunc +{{% columns %}} +- {{< card title="Card" image="" >}} + # Heading + Nullam feugiat urna massa, et fringilla metus consectetur molestie. Suspendisse sed congue orci, eu congue metus. + {{< /card >}} -Lorem **markdownum** emicat gestu. Cannis sol pressit ducta. **Est** Idaei, -tremens ausim se tutaeque, illi ulnis hausit, sed, lumina cutem. Quae avis -sequens! +- {{< card title="Card" image="" >}} + # Heading + Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa, et fringilla metus consectetur molestie. + {{< /card >}} - var panel = ram_design; - if (backup + system) { - file.readPoint = network_native; - sidebar_engine_device(cell_tftp_raster, - dual_login_paper.adf_vci.application_reader_design( - graphicsNvramCdma, lpi_footer_snmp, integer_model)); - } +- {{< card title="Card" image="" >}} + # Heading + Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa, et fringilla metus consectetur molestie. + {{< /card >}} +{{% /columns %}} -## Locis suis novi cum suoque decidit eadem +{{% columns %}} +- {{< card title="Card" >}} + ### Heading + Nullam feugiat urna massa, et fringilla metus consectetur molestie. Suspendisse sed congue orci, eu congue metus. + {{< /card >}} -Idmoniae ripis, at aves, ali missa adest, ut _et autem_, et ab? +- {{< card title="Card" >}} + ### Heading + Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa, et fringilla metus consectetur molestie. + {{< /card >}} + +- {{< card title="Card" >}} + ### Heading + Nullam feugiat urna massa, et fringilla metus consectetur molestie. Suspendisse sed congue orci, eu congue metus. + {{< /card >}} +{{% /columns %}} diff --git a/exampleSite/content.en/docs/shortcodes/cards.md b/exampleSite/content.en/docs/shortcodes/cards.md new file mode 100644 index 0000000..d3b2b84 --- /dev/null +++ b/exampleSite/content.en/docs/shortcodes/cards.md @@ -0,0 +1,30 @@ +# Cards + +## Example + +{{% columns %}} +- {{< card image="https://images.pexels.com/photos/346529/pexels-photo-346529.jpeg" >}} + ### Line 1 + Line 2 + {{< /card >}} + +- {{< card image="https://images.pexels.com/photos/346529/pexels-photo-346529.jpeg" >}} + This is tab MacOS content. + {{< /card >}} +{{% /columns %}} + +{{% columns %}} +- {{< card href="/" >}} + **Markdown** + Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa. + {{< /card >}} + +- {{< card >}} + Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa, et fringilla metus consectetur molestie. + {{< /card >}} + +- {{< card title="Card" >}} + ### Heading + This is tab MacOS content. + {{< /card >}} +{{% /columns %}} diff --git a/exampleSite/content.en/docs/shortcodes/hints.md b/exampleSite/content.en/docs/shortcodes/hints.md index f1d962b..2d00035 100644 --- a/exampleSite/content.en/docs/shortcodes/hints.md +++ b/exampleSite/content.en/docs/shortcodes/hints.md @@ -13,7 +13,6 @@ stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa > **Markdown content** > Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat > stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa - ``` ## Example @@ -51,26 +50,26 @@ stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa ## Support for markdown alerts > [!NOTE] -> **Markdown content** +> **Note** > Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat > stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa > [!TIP] -> **Markdown content** +> **Tip** > Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat > stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa > [!IMPORTANT] -> **Markdown content** +> **Important** > Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat > stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa > [!WARNING] -> **Markdown content** +> **Warning** > Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat > stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa > [!CAUTION] -> **Markdown content** +> **Caution** > Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat > stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa \ No newline at end of file diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml index 0ea73dc..65cb052 100644 --- a/exampleSite/hugo.toml +++ b/exampleSite/hugo.toml @@ -38,10 +38,25 @@ enableGitInfo = true weight = 3 [menu] +[[menu.home]] + name = "Documentation" + url = "/docs/example/" + weight = 1 + +[[menu.home]] + name = "Showcases" + url = "/showcases/" + weight = 2 + +[[menu.home]] + name = "Github" + url = "https://github.com/alex-shpak/hugo-book/" + weight = 3 + # [[menu.before]] [[menu.after]] name = "Github" - url = "https://github.com/alex-shpak/hugo-book" + url = "https://github.com/alex-shpak/hugo-book/" weight = 10 [[menu.after]] diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index 82c8c96..b1260b0 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -36,6 +36,17 @@ languages: weight: 3 menu: + home: + - name: "Documentation" + url: "/docs/example/" + weight: 1 + - name: "Showcases" + url: "/showcases/" + weight: 2 + - name: "Github" + url: "https://github.com/alex-shpak/hugo-book/" + weight: 3 + # before: [] after: - name: "Github" diff --git a/layouts/_markup/render-codeblock-katex.html b/layouts/_markup/render-codeblock-katex.html index 774edbe..94bcb55 100644 --- a/layouts/_markup/render-codeblock-katex.html +++ b/layouts/_markup/render-codeblock-katex.html @@ -9,5 +9,5 @@ {{- end -}} {{- with .Inner }} -\[ {{ . }} \] +\[ {{ .| htmlEscape | safeHTML }} \] {{ end -}} diff --git a/layouts/_markup/render-heading.html b/layouts/_markup/render-heading.html index 5439d20..d2b3c28 100644 --- a/layouts/_markup/render-heading.html +++ b/layouts/_markup/render-heading.html @@ -1,4 +1,6 @@ - - {{ .Text | safeHTML }} - # + + {{ .Text }} + {{ if default true .Page.Params.bookHeadingAnchor }} + # + {{ end }} diff --git a/layouts/_shortcodes/card.html b/layouts/_shortcodes/card.html new file mode 100644 index 0000000..d903dc4 --- /dev/null +++ b/layouts/_shortcodes/card.html @@ -0,0 +1,20 @@ +{{- /* remove whitespace */ -}} +{{- if .Get "href" -}} + +{{- template "book-card-content" . -}} + +{{- else -}} +
+{{- template "book-card-content" . -}} +
+{{- end -}} + +{{- define "book-card-content" -}} +{{- with .Get "image" -}} + +{{- end }} +
+ {{ with .InnerDeindent }}{{ . }}{{ end }} +
+{{- end -}} +{{- /* remove whitespace */ -}} diff --git a/layouts/_shortcodes/mermaid.html b/layouts/_shortcodes/mermaid.html index 07a3bfc..0745ee6 100644 --- a/layouts/_shortcodes/mermaid.html +++ b/layouts/_shortcodes/mermaid.html @@ -8,5 +8,5 @@ {{ end }}
-  {{- .Inner -}}
+  {{- .Inner | htmlEscape | safeHTML  -}}
 
diff --git a/layouts/baseof.html b/layouts/baseof.html index f38b7f5..7028858 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -4,15 +4,11 @@ {{ partial "docs/html-head" . }} {{ partial "docs/inject/head" . }} - +
- + {{ template "menu-container" . }}
@@ -29,23 +25,24 @@ {{ template "comments" . }} -
- {{ if partial "docs/toc-show" . }} - - {{ end }} + {{ template "toc-container" . }}
{{ partial "docs/inject/body" . }} +{{ define "menu-container" }} + +{{ end }} + {{ define "menu" }} {{ partial "docs/menu" . }} {{ end }} @@ -78,6 +75,16 @@ {{ end }} +{{ define "toc-container" }} +{{ if partial "docs/toc-show" . }} + +{{ end }} +{{ end }} + {{ define "toc" }} {{ partial "docs/toc" . }} {{ end }} diff --git a/layouts/home.html b/layouts/home.html new file mode 100644 index 0000000..7d4290a --- /dev/null +++ b/layouts/home.html @@ -0,0 +1,13 @@ +{{ define "menu-container" }} + +{{ end }} +{{ define "toc-container" }} + +{{ end }} +{{ define "footer" }} + +{{ end }} + +{{ define "header" }} + {{ partial "docs/menu-hugo" .Site.Menus.home }} +{{ end }}