{{- $baseurl := .Page.Permalink | safeURL -}}
{{- $url := printf "%s#%s" $baseurl .Anchor -}}
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
{{ .Text | safeHTML }}
<a class="heading-anchor" href="{{ $url }}" style="color: var(--text-muted); font-size: smaller;">
{{ "#" }}
</a>
</h{{ .Level }}>