From cdef5afeed810c8e4714882bf223f82bc10a1037 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 23 Oct 2024 17:21:35 +0000 Subject: [PATCH] add disable animation, mermaid support Signed-off-by: GitHub Action --- assets/scss/_colors.scss | 1 + assets/scss/style.scss | 6 +++--- hugo.toml.example | 3 +-- layouts/_default/_markup/render-codeblock-mermaid.html | 5 +++++ layouts/_default/baseof.html | 7 +------ layouts/partials/mermaid.html | 6 ++++++ 6 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 layouts/_default/_markup/render-codeblock-mermaid.html create mode 100644 layouts/partials/mermaid.html diff --git a/assets/scss/_colors.scss b/assets/scss/_colors.scss index 8639125..9f241a1 100644 --- a/assets/scss/_colors.scss +++ b/assets/scss/_colors.scss @@ -6,6 +6,7 @@ $dark-grey: #3b3e48 !default; $highlight-grey: #7d828a !default; $midnightblue: #2c3e50 !default; $typewriter: hsl(172, 100%, 36%) !default; +$codebackground: #272822 !default; // Scroll to Top Default colors $stt-stroke: #ccc !default; diff --git a/assets/scss/style.scss b/assets/scss/style.scss index 35a8123..f490a4b 100644 --- a/assets/scss/style.scss +++ b/assets/scss/style.scss @@ -1,9 +1,7 @@ @import "predefined.scss"; @import "normalize.scss"; @import "syntax.scss"; -{{ if ne false .Site.Params.usesAnimation }} @import "animate.scss"; -{{ end }} @import "scroll.scss"; @import "socialshare.scss"; {{ if (fileExists "assets/scss/userstyles.scss") }} @@ -66,7 +64,9 @@ pre { background: $midnightblue; overflow-x: auto; -webkit-overflow-scrolling: touch; - + &.mermaid { + background: $codebackground; + } code { padding: 0; margin: 0; diff --git a/hugo.toml.example b/hugo.toml.example index cbfa8fc..0ee7054 100644 --- a/hugo.toml.example +++ b/hugo.toml.example @@ -119,8 +119,7 @@ expiryDate = ["expiryDate"] # allowRobots = "index, follow" # siteNoIndex = false # noIndexPages = ["404 Page not found"] - # usesAnimation = true # Defaults to true - + # usesAnimation = true [[params.socialLinks]] name = "mastodon" diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html new file mode 100644 index 0000000..a4ac44a --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -0,0 +1,5 @@ +{{ .Page.Store.Set "hasMermaid" true -}} + +
+  {{- .Inner | safeHTML }}
+
\ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 13171ea..d1717f3 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -46,12 +46,7 @@ {{- end }} {{- partial "mathjax.html" . -}} -{{ if .Page.Store.Get "hasMermaid" }} - -{{ end }} +{{- partial "mermaid.html" . -}} {{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }} diff --git a/layouts/partials/mermaid.html b/layouts/partials/mermaid.html new file mode 100644 index 0000000..2208d0a --- /dev/null +++ b/layouts/partials/mermaid.html @@ -0,0 +1,6 @@ +{{- if .Page.Store.Get "hasMermaid" -}} + +{{- end -}} \ No newline at end of file