{{- $codeIndex := (.Page.Scratch.Get "codeIndex") -}} {{- $id := (printf `code-%d` $codeIndex) -}} {{ with .Parent }} {{- with .Get "id" -}} {{- $id = . -}} {{- end -}} {{- end -}}
Code snippet {{ $codeIndex }}{{with .Get "lang"}} ({{ . }}){{ end -}} : {{ .Inner | markdownify | safeHTML }}
{{- .Page.Scratch.Set "codeIndex" (add 1 $codeIndex) -}}