From 15ec6bbc1913e8de220da4e50322e1259ad02b86 Mon Sep 17 00:00:00 2001 From: Johannes Kimmel Date: Fri, 18 Nov 2022 17:06:38 +0100 Subject: [PATCH] add hugo-book theme module customization: - automatically add title to every page - allow mermaid codeblocks to render without shortcodes --- config.yaml | 9 +++++++++ go.mod | 5 +++++ go.sum | 2 ++ .../_default/_markup/render-codeblock-mermaid.html | 12 ++++++++++++ layouts/_default/list.html | 6 ++++++ layouts/_default/single.html | 6 ++++++ 6 files changed, 40 insertions(+) create mode 100644 go.mod create mode 100644 go.sum create mode 100644 layouts/_default/_markup/render-codeblock-mermaid.html create mode 100644 layouts/_default/list.html create mode 100644 layouts/_default/single.html diff --git a/config.yaml b/config.yaml index 8fff8b6..97a64f4 100644 --- a/config.yaml +++ b/config.yaml @@ -9,3 +9,12 @@ enableGitInfo: true markup: tableOfContents: endLevel: 4 + +module: + imports: + - path: github.com/alex-shpak/hugo-book + +params: + # https://themes.gohugo.io/themes/hugo-book/ + BookSection: "*" + # BookTheme: auto # erst Grafiken anpassen diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..fcfb535 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module git.freifunk-franken.de/freifunk-franken/docs + +go 1.19 + +require github.com/alex-shpak/hugo-book v0.0.0-20221111100854-d5b75f4fb3aa // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..56905fe --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/alex-shpak/hugo-book v0.0.0-20221111100854-d5b75f4fb3aa h1:VthswmcR+7NtpamidIRuFq+8JRAz4v+s7xVJ0MmeLqM= +github.com/alex-shpak/hugo-book v0.0.0-20221111100854-d5b75f4fb3aa/go.mod h1:L4NMyzbn15fpLIpmmtDg9ZFFyTZzw87/lk7M2bMQ7ds= diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html new file mode 100644 index 0000000..6a0664e --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -0,0 +1,12 @@ +{{ if not (.Page.Scratch.Get "mermaid") }} + + +{{ with resources.Get "mermaid.json" }} + +{{ end }} +{{ .Page.Scratch.Set "mermaid" true }} +{{ end }} + +

+ {{- .Inner -}} +

diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..f0c6253 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,6 @@ +{{ define "main" }} +
+

{{- .Page.Title -}}

+ {{- .Content -}} +
+{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..f0c6253 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,6 @@ +{{ define "main" }} +
+

{{- .Page.Title -}}

+ {{- .Content -}} +
+{{ end }}