{{/* Context: codeblock render hook */}}

{{ $params := dict }}
{{ $page := .Page }}

{{ $ordinal := add .Ordinal 1 }}
{{- with site.Data.modImg.id.diagram.anchor | default "diag-%d" }}
    {{- $params = merge $params (dict (slice "attrs" "id") (printf . $ordinal)) }}
{{- end }}
{{- with site.Data.modImg.id.diagram.caption | default "Diag&#x202f;%d:" }}
    {{ if (in site.Data.modImg.id.sections $page.Section) }}
        {{ $params = merge $params (dict (slice "caption" "id") (printf . $ordinal)) }}
    {{ 