blob: 1321d8e73e7b36d2208af2467d063d81432c1226 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
{{- $caption := .Attributes.caption -}}
{{- $type := .Type | default "text" -}}
{{- $options := .Attributes.options | default "default=1" -}}
{{- $hash := print (truncate 3 "" (sha256 .Inner)) (truncate 3 "" (sha256 .Page.RelPermalink)) .Ordinal -}}
{{- $id := print "code-block:" $hash | safeURL -}}
<code-block id="{{ $id }}" {{ if in (lower $options) "linenos" }}data-lines=""{{ end }}>
<header>
<language-label>
<a href="#{{ $id }}">{{ $type }}</a>
</language-label>
</header>
{{ highlight .Inner $type (print $options ",lineAnchors=" "code-line:" $hash) }}
</code-block>
{{ with $caption }}
<footer>{{ . | markdownify }}</footer>
{{ end }}
|