From 24d08d580d61363faab495a8a022248a7499dc26 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 03 May 2022 14:43:22 +0000
Subject: [PATCH] cfg: make SPA optional

---
 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