blob: 85e04c9e100af3c4357722657ea4363b827372a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<!--
Anchor links will be only set with level 2 and 3 headings
TODO
It looks weird when the heading is also a link,
but then that's also true for links in ToCs
Would like to test a few more things
-->
{{ $svgBundle := ($.Page.Scratch.Get "svgBundle").RelPermalink }}
{{ $anchoredLinkLevels := slice 2 3 }}
{{ if in $anchoredLinkLevels .Level }}
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} {{ printf "<a class=\"anchor\" href=\"#%s\" title='%s \"%s\".'><svg aria-hidden=\"true\"><use xlink:href=\"%s#hashtag\"/></svg></a>" (.Anchor | safeURL) (T "anchor_for") (.Text | plainify | safeHTML) $svgBundle | safeHTML }}</h{{ .Level }}>
{{ else }}
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}</h{{ .Level }}>
{{ end }}
|