layouts: use heading render hook

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-05-30 13:59:24 +05:30
parent 266835b881
commit ac76633bcd
2 changed files with 2 additions and 3 deletions

View File

@ -0,0 +1 @@
<a href="#{{ .Anchor | safeURL }}" class="heading-anchor"><h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}</h{{ .Level}}></h></a>

View File

@ -9,9 +9,7 @@
</p> </p>
<div class="tag-container"> <div class="tag-container">
</div> </div>
{{- with .Content -}} {{ .Content }}
{{ . | replaceRE "(<h[1-2] id=\"([^\"]+)\".+)(</h[1-9]+>)" `<a href="#${2}" class="heading-anchor" ariaLabel="Anchor"> ${1}</a> ${3}` | safeHTML }}
{{- end -}}
</div> </div>
{{ if and .Site.Params.CommentoURL (and (not .Site.BuildDrafts) (not .Site.IsServer)) -}} {{ if and .Site.Params.CommentoURL (and (not .Site.BuildDrafts) (not .Site.IsServer)) -}}