use heading render hook instead of refactor

This commit is contained in:
geekifan
2025-04-29 11:14:55 +08:00
parent 8bdf964087
commit 3e62b36e0f
2 changed files with 8 additions and 15 deletions

View File

@ -0,0 +1,8 @@
<h{{ .Level }} id="{{ .Anchor }}" {{- range $key, $value := .Attributes }} {{- printf " %s=%v" $key $value | safeHTMLAttr }}{{- end }}>
{{ if and (ne .Level 1) (not (index .Attributes "data-toc-skip")) }}
<span class="me-2">{{- .Text -}}</span>
<a href="#{{ .Anchor }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>
{{ else }}
{{- .Text -}}
{{ end }}
</h{{ .Level }}>