2022-06-21 15:50:51 +02:00
{{ $id := delimit (shuffle (seq 1 9)) "" }}
2025-03-10 13:47:59 +01:00
{{ $open := .Get "open" }}
{{ $lang := .Get "language" }}
{{ $opts := .Get "opts" }}
2022-06-21 15:50:51 +02:00
2025-03-10 13:47:59 +01:00
{{- if $lang -}}
< details class = "collapsable-code" { { if eq $ open " true " - } } open { { - end } } >
< summary title = "Click to interact" >
{{- if .Get "title" }}< span class = "collapsable-code__title" > {{ .Get "title" | markdownify }}< / span > {{ end -}}
< / summary >
{{ $trInner := trim .Inner "\n" }}
{{- transform.Highlight $trInner $lang $opts -}}
< / details >
2022-06-21 15:50:51 +02:00
{{ else }}
{{ errorf "If you want to use the \"collapsable code\" shortcode, you need to pass a mandatory \"language\" param. The issue occured in %q (%q)" .Page.File .Page.Permalink }}
2025-03-10 13:47:59 +01:00
{{- end -}}