{{- $name := .Get 0 -}}
{{- $number := 1 -}}
{{- with .Page.Store.Get "internal-ref-counter" -}}
{{- $number = add . 1 }}
{{- end -}}
{{- .Page.Store.Set "internal-ref-counter" $number -}}
{{- .Page.Store.SetInMap "internal-ref" $name $number -}}

<span class="internal-ref" id="internal-ref-{{ $name }}">
{{ .Inner }}
<span class="internal-ref-counter">{{ $number }}</span></span>
{{- /* chomp whitespace at the end */ -}}
