0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-30 22:52:24 +01:00

render-heading.html: use variables

This commit is contained in:
XhmikosR 2023-08-06 09:40:35 +03:00
parent 87be2b9d24
commit 688d7e352a

View File

@ -1,5 +1,7 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
{{- $id := .Anchor | safeURL -}}
{{- $text := .Text | safeHTML -}}
<h{{ .Level }} id="{{ $id }}">{{ $text }}
{{- if and (ge .Level .Page.Site.Params.anchors.min) (le .Level .Page.Site.Params.anchors.max) }}{{" " -}}
<a class="anchor-link" href="#{{ .Anchor | safeURL }}" aria-label="Link to this section: {{ .Text | safeHTML }}"></a>
<a class="anchor-link" href="#{{ $id }}" aria-label="Link to this section: {{ $text }}"></a>
{{- end -}}
</h{{ .Level }}>