{{- $result := transform.HighlightCodeBlock . }} {{- $caption := .Attributes.caption }} {{- $title := .Attributes.title }} {{- if $caption }} {{- printf "" (string (add .Ordinal 1)) | safeHTML }}
{{ with $title }}

{{.}}

{{ end }}
{{
	(
		replaceRE
		`(?s)(.*?)`
		`$1`
		(
			replaceRE
			`(?s)(.*?)`
			`$1`
			$result.Inner
		)
	) | safeHTML
}}
{{$caption | markdownify}}
{{ printf "" (string (add .Ordinal 1)) | safeHTML }} {{ else }}{{/* not a figure, just a regular codeblock */}} {{- printf "" (string (add .Ordinal 1)) | safeHTML }}
{{- with $title }}

{{.}}

{{- end }}
{{
	(
		replaceRE
		`(?s)(.*?)`
		`$1`
		(
			replaceRE
			`(?s)(.*?)`
			`$1`
			$result.Inner
		)
	) | safeHTML
}}
{{- printf "" (string (add .Ordinal 1)) | safeHTML }} {{ end }}