hugo-theme-terminal

My Fork of the Terminal Hugo Theme
git clone https://git.repetitions.de/hugo-theme-terminal

code.html (932B)


 1 {{ $id := delimit (shuffle (seq 1 9)) "" }}
 2 
 3 {{ if .Get "language" }}
 4   <div class="collapsable-code">
 5     <input id="{{ .Get "id" | default $id }}" type="checkbox" {{ if ( eq ( .Get "isCollapsed" ) "true" ) -}} checked {{- end }} />
 6     <label for="{{ .Get "id" | default $id }}">
 7       <span class="collapsable-code__language">{{ .Get "language" }}</span>
 8       {{ if .Get "title" }}<span class="collapsable-code__title">{{ .Get "title" | markdownify }}</span>{{ end }}
 9       <span class="collapsable-code__toggle" data-label-expand="{{ .Get "expand" | default "△" }}" data-label-collapse="{{ .Get "collapse" | default "▽" }}"></span>
10     </label>
11       {{ transform.Highlight  (trim .Inner "\r\n") (.Get "language")}}
12   </div>
13 {{ else }}
14   {{ 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 }}
15 {{ end }}
16