summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAditya Telange <21258296+adityatelange@users.noreply.github.com>2020-11-10 12:15:56 +0530
committerAditya Telange <21258296+adityatelange@users.noreply.github.com>2020-11-10 12:34:22 +0530
commitcf4fd27e3da24a1258339c3aa186efcac711b044 (patch)
tree025ba31838ddaa469dbb2182db67348d13c8ac49 /layouts
parent2b0619f684f3b4fabdcd6457d4302f8011a059ee (diff)
anchored-headings: port to PaperMod
- add corresponding css - gen anchored headings for h1-h6 - link with single.html
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/partials/anchored_headings.html2
2 files changed, 4 insertions, 2 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index d4476ed..e46d05f 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -41,7 +41,9 @@
</details>
</div>
{{- end }}
- <div class="post-content">{{ .Content }}</div>
+ <div class="post-content">
+ {{- partial "anchored_headings.html" .Content -}}
+ </div>
<footer class="post-footer">
{{- if .Params.tags }}
<ul class="post-tags">
diff --git a/layouts/partials/anchored_headings.html b/layouts/partials/anchored_headings.html
index 62a5084..27184fe 100644
--- a/layouts/partials/anchored_headings.html
+++ b/layouts/partials/anchored_headings.html
@@ -1,2 +1,2 @@
<!-- formats .Content headings by adding an anchor -->
-{{ . | replaceRE "(<h[2-3] id=\"([^\"]+)\".+)(</h[2-9]+>)" "${1}<a class=\"anchor\" href=\"#${2}\">#</a>${3}" | safeHTML }}
+{{ . | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" "${1}<a hidden class=\"anchor\" aria-hidden=\"true\" href=\"#${2}\">#</a>${3}" | safeHTML }}