blob: 91ee9f6fa717ad71ed61121fa3960ff1a09ba0b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
{{- $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 -}}
{{- $edit := "false" -}}
<code-block id="{{ $id }}" {{ if in (lower $options) "linenos" }}data-lines=""{{ end }}>
<header>
<language-label>
<a href="#{{ $id }}">{{ $type }}</a>
</language-label>
</header>
<code-content contenteditable="true" spellcheck="false">
{{- highlight .Inner $type (print $options ",lineAnchors=" "code-line:" $hash) -}}
</code-content>
</code-block>
{{- with $caption -}}
<footer>{{ . | markdownify }}</footer>
{{- end -}}
|