From 9b5f3fad7068298265dbbc8a65077f7917a090a5 Mon Sep 17 00:00:00 2001 From: aethrvmn Date: Sun, 21 Sep 2025 00:27:35 +0200 Subject: updated hugo-book theme --- themes/hugo-book/layouts/_markup/render-blockquote.html | 9 +++++++++ .../hugo-book/layouts/_markup/render-codeblock-katex.html | 13 +++++++++++++ .../hugo-book/layouts/_markup/render-codeblock-mermaid.html | 12 ++++++++++++ themes/hugo-book/layouts/_markup/render-codeblock.html | 10 ++++++++++ themes/hugo-book/layouts/_markup/render-heading.html | 6 ++++++ themes/hugo-book/layouts/_markup/render-image.html | 6 ++++++ themes/hugo-book/layouts/_markup/render-link.html | 6 ++++++ 7 files changed, 62 insertions(+) create mode 100644 themes/hugo-book/layouts/_markup/render-blockquote.html create mode 100644 themes/hugo-book/layouts/_markup/render-codeblock-katex.html create mode 100644 themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html create mode 100644 themes/hugo-book/layouts/_markup/render-codeblock.html create mode 100644 themes/hugo-book/layouts/_markup/render-heading.html create mode 100644 themes/hugo-book/layouts/_markup/render-image.html create mode 100644 themes/hugo-book/layouts/_markup/render-link.html (limited to 'themes/hugo-book/layouts/_markup') diff --git a/themes/hugo-book/layouts/_markup/render-blockquote.html b/themes/hugo-book/layouts/_markup/render-blockquote.html new file mode 100644 index 0000000..88809a1 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-blockquote.html @@ -0,0 +1,9 @@ +{{- $attributes := .Attributes }} +{{- $class := printf "book-hint %s" ($.AlertType | lower) }} +{{- if isset $attributes "class" }} + {{ $class = printf "%s %s" $class (index $attributes "class") }} +{{ end -}} +{{- $attributes = merge $attributes (dict "class" $class) }} +
+ {{ .Text }} +
\ No newline at end of file diff --git a/themes/hugo-book/layouts/_markup/render-codeblock-katex.html b/themes/hugo-book/layouts/_markup/render-codeblock-katex.html new file mode 100644 index 0000000..94bcb55 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock-katex.html @@ -0,0 +1,13 @@ +{{- if not (.Page.Store.Get "katex") -}} + + + +{{ with resources.Get "katex.json" }} + +{{ end }} +{{- .Page.Store.Set "katex" true -}} +{{- end -}} + +{{- with .Inner }} +\[ {{ .| htmlEscape | safeHTML }} \] +{{ end -}} diff --git a/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html b/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html new file mode 100644 index 0000000..097857a --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock-mermaid.html @@ -0,0 +1,12 @@ +{{ if not (.Page.Store.Get "mermaid") }} + + +{{ with resources.Get "mermaid.json" }} + +{{ end }} +{{ .Page.Store.Set "mermaid" true }} +{{ end }} + +
+  {{- .Inner -}}
+
diff --git a/themes/hugo-book/layouts/_markup/render-codeblock.html b/themes/hugo-book/layouts/_markup/render-codeblock.html new file mode 100644 index 0000000..a79563f --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-codeblock.html @@ -0,0 +1,10 @@ +{{- with (index .Attributes "filename") -}} + {{- $href := index $.Attributes "href" -}} + {{- if $href -}} + {{- $href = partial "docs/links/portable-link" (dict "Page" $.PageInner "Destination" $href) -}} + {{- end -}} +
+ {{ . }} +
+{{- end -}} +{{- (transform.HighlightCodeBlock . .Options).Wrapped -}} diff --git a/themes/hugo-book/layouts/_markup/render-heading.html b/themes/hugo-book/layouts/_markup/render-heading.html new file mode 100644 index 0000000..d2b3c28 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-heading.html @@ -0,0 +1,6 @@ + + {{ .Text }} + {{ if default true .Page.Params.bookHeadingAnchor }} + # + {{ end }} + diff --git a/themes/hugo-book/layouts/_markup/render-image.html b/themes/hugo-book/layouts/_markup/render-image.html new file mode 100644 index 0000000..2453b46 --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-image.html @@ -0,0 +1,6 @@ +{{- $destination := .Destination -}} +{{- if .Page.Site.Params.BookPortableLinks -}} + {{- $destination = partial "docs/links/portable-image" . -}} +{{- end -}} +{{ .Text }} +{{- /**/ -}} \ No newline at end of file diff --git a/themes/hugo-book/layouts/_markup/render-link.html b/themes/hugo-book/layouts/_markup/render-link.html new file mode 100644 index 0000000..8aefa3f --- /dev/null +++ b/themes/hugo-book/layouts/_markup/render-link.html @@ -0,0 +1,6 @@ +{{- $destination := .Destination -}} +{{- if .Page.Site.Params.BookPortableLinks -}} + {{- $destination = partial "docs/links/portable-link" . -}} +{{- end -}} +{{ .Text | safeHTML }} +{{- /**/ -}} \ No newline at end of file -- cgit v1.2.3