From e302f6c423136d1dbdfda48c2b241e62bb5654e7 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 06 May 2022 00:35:32 +0000
Subject: [PATCH] fix: more generic style to match bad nesting generated by popover interp
---
layouts/partials/textprocessing.html | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
index f614868..8e8c999 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -10,7 +10,7 @@
{{end}}
{{/* Wikilinks */}}
-{{$wikilinks := $raw | findRE "!?\\[\\[\\S[^\\[\\]\\|]*(?:\\|[^\\[\\]]*)?\\S\\]\\]" }}
+{{$wikilinks := $content | findRE "!?\\[\\[\\S[^\\[\\]\\|]*(?:\\|[^\\[\\]]*)?\\S\\]\\]" }}
{{$codefences := $raw | findRE "\\x60[^\\x60\\n]+\\x60"}}
{{$codeblocks := $raw | findRE "\\x60{3}[^\\x60]+\\x60{3}"}}
{{$code := union $codefences $codeblocks}}
@@ -53,4 +53,8 @@
{{end}}
{{end}}
{{end}}
+
+{{/* Add copyable anchors */}}
+{{ $content = $content | replaceRE "(<h[1-9] id=\"([^\"]+)\">)(.+)(</h[1-9]>)" `<a href="#${2}">${1}<span class="hanchor" ariaLabel="Anchor"># </span>${3}${4}</a>` }}
+
{{ $content | safeHTML }}
--
Gitblit v1.10.0