From 9c9ced66c32c1d293fa1e124f839bb524a45b0a4 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Mon, 11 Mar 2024 23:20:35 -0700 Subject: [PATCH] Allow hiding code in code blocks --- layouts/shortcodes/codelines.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/layouts/shortcodes/codelines.html b/layouts/shortcodes/codelines.html index 0d8e7d6..db1ca47 100644 --- a/layouts/shortcodes/codelines.html +++ b/layouts/shortcodes/codelines.html @@ -13,7 +13,17 @@ {{ .Scratch.Set "opts" "" }} {{ end }} +{{ if (.Get 5) }} +{{ .Scratch.Set "hidden" (.Get 5) }} +{{ end }} + {{ partial "geturl.html" (dict "scratch" .Scratch "path" (.Get 1) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Params.submoduleLinks) }} {{ partial "linerangestr.html" (dict "scratch" .Scratch "from" (.Get 2) "to" (.Get 3)) }} +{{ with (.Scratch.Get "hidden") }} +
{{ . | markdownify }} +{{ end }} {{ partial "highlightgroup.html" (dict "url" (.Scratch.Get "bestUrl") "path" (.Get 1) "comment" (.Scratch.Get "comment") "code" (delimit $lines "\n") "language" (.Get 0) "opts" (printf "linenos=table,linenostart=%d%s" (.Get 2) (.Scratch.Get "opts"))) }} +{{ with (.Scratch.Get "hidden") }} +
+{{ end }}