Welcome to mirror list, hosted at ThFree Co, Russian Federation.

render-heading.html « _markup « _default « layouts - gitlab.com/rmaguiar/hugo-theme-color-your-world.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0beefd5ea1418bd608a0989f843f485093c721c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!--
  Anchor links for heading
  Level 2 to 6
  
  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
-->

{{ $anchoredLinkLevels := seq 2 6 }}

{{ if in $anchoredLinkLevels .Level }}
  <h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ printf "<a class=\"anchor\" href=\"#%s\" title='%s \"%s\".'><svg aria-hidden=\"true\"><use xlink:href=\"#hashtag\"/></svg></a>" (.Anchor | safeURL) (T "anchorFor") (.Text | plainify | safeHTML) | safeHTML }} {{ .Text | safeHTML }}</h{{ .Level }}> 
{{ else }}
  <h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}</h{{ .Level }}> 
{{ end }}