aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorCaio Lente <7017340+clente@users.noreply.github.com>2023-10-27 19:31:22 -0300
committerCaio Lente <7017340+clente@users.noreply.github.com>2023-10-27 19:31:22 -0300
commit488fcc401fa605a5d79fbf98754556de2cf09d18 (patch)
treeaa3fbbcee5a1d6204a6c05be82ab4370f03bacbc /layouts
parent20cbc4a5ae79efe1d442a37cc4fccfb498e433f3 (diff)
parenta3f09559e465ea1255baf83345fc7fd1b2da62b3 (diff)
downloadhugo-bearcub-488fcc401fa605a5d79fbf98754556de2cf09d18.tar.gz
hugo-bearcub-488fcc401fa605a5d79fbf98754556de2cf09d18.tar.bz2
Merge remote-tracking branch 'origin/main' into style/herman
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/_markup/render-codeblock.html6
-rw-r--r--layouts/_default/baseof.html6
-rw-r--r--layouts/shortcodes/highlight.html5
3 files changed, 15 insertions, 2 deletions
diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html
new file mode 100644
index 0000000..6e1a075
--- /dev/null
+++ b/layouts/_default/_markup/render-codeblock.html
@@ -0,0 +1,6 @@
+<!-- https://github.com/jmooring/hugo-testing/blob/hugo-forum-topic-40998/layouts/_default/_markup/render-codeblock-katex.html -->
+{{ .Page.Store.Set "hasCodeBlock" true }}
+
+<!-- https://www.veriphor.com/articles/code-block-render-hooks/ -->
+{{ $result := transform.HighlightCodeBlock . }}
+{{ $result.Wrapped }} \ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index bddfe68..e5c4f01 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -14,8 +14,10 @@
{{ $style := resources.Get "herman.css" | minify }}
<link href="{{ $style.RelPermalink }}" rel="stylesheet">
- {{ $syntax := resources.Get "syntax.css" | minify }}
- <link href="{{ $syntax.RelPermalink }}" rel="stylesheet">
+ {{ if (.Page.Store.Get "hasCodeBlock") }}
+ {{ $syntax := resources.Get "syntax.css" | minify }}
+ <link href="{{ $syntax.RelPermalink }}" rel="stylesheet">
+ {{ end }}
{{ with .Params.style }}
{{ $extra := resources.Get . | minify }}
diff --git a/layouts/shortcodes/highlight.html b/layouts/shortcodes/highlight.html
new file mode 100644
index 0000000..6c86ca8
--- /dev/null
+++ b/layouts/shortcodes/highlight.html
@@ -0,0 +1,5 @@
+<!-- https://github.com/jmooring/hugo-testing/blob/hugo-forum-topic-40998/layouts/_default/_markup/render-codeblock-katex.html -->
+{{ .Page.Store.Set "hasCodeBlock" true }}
+
+<!-- https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/highlight.html -->
+{{ if len .Params | eq 2 }}{{ highlight (trim .InnerDeindent "\n\r") (.Get 0) (.Get 1) }}{{ else }}{{ highlight (trim .InnerDeindent "\n\r") (.Get 0) "" }}{{ end }} \ No newline at end of file