aboutsummaryrefslogtreecommitdiff
path: root/generators/hugo/themes/tdro/layouts/_default/_markup/render-codeblock.html
blob: 7541268fe59a81701afac3afa56b2042f1c8cb31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{{- $caption := .Attributes.caption -}}
{{- $type    := .Type | default "text" -}}
{{- $options := .Attributes.options | default "default=1" -}}
{{- $id      := print "code-block-" (truncate 7 "" (md5 .Inner)) -}}

<code-block id="{{ $id }}" {{ if in (lower $options) "linenos" }}data-lines{{ end }}>
  <header>
  <language-label>
    <a href="#{{ $id }}"><code>{{ $type }}</code></a>
  </language-label>
  </header>
  {{ highlight .Inner $type (print $options ",lineAnchors=" "code-line-" (truncate 7 "" (md5 .Inner))) }}
</code-block>

{{- with $caption -}}
  <footer>{{- . | markdownify -}}</footer>
{{- end -}}