hugo-theme-termlite/layouts/_default/_markup/render-heading.html

12 lines
512 B
HTML
Raw Normal View History

{{- $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 }}>