aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/_markup/render-codeblock.html
blob: 9dba95080896fda3034da99182f1b5963b16bfad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{{ $options  := .Attributes.options | default "default=1" }}
{{ $caption  := .Attributes.caption }}

<code-block {{ if in (lower $options) "linenos" }}data-lines{{ end }}>
  <header>
  <language-label>
  {{ .Type }}
  </language-label>
    <button>
      {{ safeHTML (readFile "static/icons/feather/copy.svg") }}
      <span>Copy</span>
    </button>
  </header>
    {{ highlight .Inner .Type (print $options ",lineAnchors=" "code-" (truncate 7 "" (md5 .Inner))) }}
</code-block>

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