2024-10-15 08:09:14 +00:00
|
|
|
{{- $result := transform.HighlightCodeBlock . }}
|
|
|
|
{{- $caption := .Attributes.caption }}
|
|
|
|
{{- $title := .Attributes.title }}
|
|
|
|
{{- if $caption }}
|
|
|
|
{{- printf "<!-- begin figure with codeblock %s -->" (string (add .Ordinal 1)) | safeHTML }}
|
|
|
|
<figure class="figure-with-codeblock"{{if $title}} title="{{$title}}"{{end}}>
|
|
|
|
{{ with $title }}<header class="codeblock__header"><p class="codeblock__title">{{.}}</p></header>{{ end }}
|
2024-10-12 18:45:14 +00:00
|
|
|
<div class="codeblock highlight">
|
2024-10-15 08:09:14 +00:00
|
|
|
<pre class="chroma">
|
|
|
|
{{$result.Inner}}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
<figcaption>{{$caption | markdownify}}</figcaption>
|
|
|
|
</figure>
|
|
|
|
{{ printf "<!-- end figure with codeblock %s -->" (string (add .Ordinal 1)) | safeHTML }}
|
|
|
|
{{ else }}
|
|
|
|
{{- printf "<!-- begin codeblock %s -->" (string (add .Ordinal 1)) | safeHTML }}
|
|
|
|
<div class="codeblock highlight">
|
|
|
|
{{- with $title }}
|
|
|
|
<header class="codeblock__header">
|
|
|
|
<p class="codeblock__title">{{.}}</p>
|
|
|
|
</header>
|
|
|
|
{{- end }}
|
|
|
|
<pre class="chroma">
|
|
|
|
{{$result.Inner}}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
{{- printf "<!-- end codeblock %s -->" (string (add .Ordinal 1)) | safeHTML }}
|
|
|
|
{{ end }}
|