hugo-theme-termlite/layouts/_default/_markup/render-heading.html
Eryn Wells cce432fe0b RenderHooks: Reconfigure the heading hashes
Instead of a single hash in the left gutter, draw <n> hashes where <n> is the
heading level. All of these hashes are part of the anchor text.
2024-07-20 17:29:49 -07:00

11 lines
512 B
HTML

{{- $pageWantsAnchors := .Page.Params.renderHeadingAnchors | default true -}}
{{- $anchorEnabledForThisHeading := .Attributes.anchor | default true -}}
{{- $hasAnchor := and $pageWantsAnchors $anchorEnabledForThisHeading -}}
<h{{ .Level }} id="{{ .Anchor }}" class="heading{{ if $hasAnchor }} with-anchor{{ end }}">
{{- if $hasAnchor -}}
<span class="heading__anchor">
<a href="#{{ .Anchor }}">{{ range seq .Level }}#{{ end }}</a>
</span>
{{- end -}}
{{ .Text | safeHTML }}
</h{{ .Level }}>