🎨 Move heading anchors to render hook

This commit is contained in:
James Panther
2021-08-13 17:17:32 +10:00
parent d0ddf5f8c5
commit b1168b98dc
6 changed files with 10 additions and 9 deletions
@@ -0,0 +1 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} <a class="heading-anchor" href="#{{ .Anchor | safeURL }}" aria-label="Anchor">#</a></h{{ .Level }}>
+1 -1
View File
@@ -7,7 +7,7 @@
</div>
</header>
<section class="prose dark:prose-light">
{{ partial "heading-anchor.html" .Content | emojify }}
{{ .Content | emojify }}
</section>
<footer>
{{ partialCached "author.html" . }}
-1
View File
@@ -22,7 +22,6 @@
{{ with .Site.Params.keywords -}}
<meta name="keywords" content="{{ . }}" />
{{- end }}
<base href="{{ .Site.BaseURL }}" />
<link rel="canonical" href="{{ .Permalink }}" />
{{/* Styles */}}
<link type="text/css" rel="stylesheet" href="{{ "css/main.css" | absURL }}" />
-1
View File
@@ -1 +0,0 @@
{{ . | replaceRE "(<h[2-4] id=\"([^\"]+)\".+)(</h[2-9]+>)" `${1}&nbsp;<a class="heading-anchor" href="#${2}" aria-label="Anchor">#</a> ${3}` | safeHTML }}