porcellis.com

ref: master

layouts/_markup/render-codeblock.html


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{{- /*
  Code block frame: a header bar identifying the snippet, then the highlighted
  code. The left label is the fence's filename attribute when present, falling
  back to the language; neither is worth repeating twice, so the header carries
  a single label.
*/ -}}
{{- $lang := .Type | default "text" -}}
{{- $highlighted := transform.HighlightCodeBlock . -}}
<div class="codeblock">
  <div class="codeblock__header">
    <span class="codeblock__label">
      <span class="codeblock__dot" aria-hidden="true"></span>
      {{ with .Attributes.filename }}{{ . }}{{ else }}{{ $lang | upper }}{{ end }}
    </span>
  </div>
  {{ $highlighted.Wrapped }}
</div>