Allow hiding code in code blocks

This commit is contained in:
Danila Fedorin 2024-03-11 23:20:35 -07:00
parent 9b9a6dca5f
commit 9c9ced66c3

View File

@ -13,7 +13,17 @@
{{ .Scratch.Set "opts" "" }} {{ .Scratch.Set "opts" "" }}
{{ end }} {{ 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 "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)) }} {{ partial "linerangestr.html" (dict "scratch" .Scratch "from" (.Get 2) "to" (.Get 3)) }}
{{ with (.Scratch.Get "hidden") }}
<details><summary>{{ . | markdownify }}</summary>
{{ 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"))) }} {{ 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") }}
</details>
{{ end }}