diff --git a/assets/js/popover.js b/assets/js/popover.js
index 3d0d18b..83cdc03 100644
--- a/assets/js/popover.js
+++ b/assets/js/popover.js
@@ -11,6 +11,7 @@ function initPopover(baseURL) {
fetchData.then(({ content }) => {
const links = [...document.getElementsByClassName("internal-link")]
links.forEach(li => {
+ console.log(li.dataset)
const linkDest = content[li.dataset.src.replace(basePath, "")]
if (linkDest) {
const popoverElement = `
diff --git a/content/notes/CJK + Latex Support (测试).md b/content/notes/CJK + Latex Support (测试).md
index 5dc0b48..e4692d7 100644
--- a/content/notes/CJK + Latex Support (测试).md
+++ b/content/notes/CJK + Latex Support (测试).md
@@ -38,4 +38,10 @@ a & b & c
$$
## RTL
-More information on configuring RTL languages like Arabic in the [config](notes/config.md) page
\ No newline at end of file
+More information on configuring RTL languages like Arabic in the [config](notes/config.md) page
+
+[[notes/troubleshooting]]
+
+[[notes/editing#Folder Structure|edit]]
+
+[[asdfasdf|todo]]
\ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 21e7066..c09f2dc 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -28,7 +28,7 @@
{{ .TableOfContents }}
{{end}}
- {{.Content | safeHTML}}
+ {{partial "textprocessing.html" . }}
{{partial "footer.html" .}}
{{partial "popover.html" .}}
diff --git a/layouts/index.html b/layouts/index.html
index 75b24bf..d449c27 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -19,7 +19,7 @@
{{ .TableOfContents }}
{{end}}
- {{.Content | safeHTML}}
+ {{partial "textprocessing.html" . }}
{{partial "footer.html" .}}
{{partial "popover.html" .}}
diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
new file mode 100644
index 0000000..8e4a794
--- /dev/null
+++ b/layouts/partials/textprocessing.html
@@ -0,0 +1,31 @@
+{{ $content := .Content }}
+{{ $page := .Page }}
+
+{{/* Replace right arrow */}}
+{{ $content = replace $content "->" "→" }}
+
+{{/* Escape slashes for Latex to fix line breaks */}}
+{{ $content = replaceRE "\\\\ *\n" "\\\\" $content }}
+
+{{/* Wikilinks */}}
+{{$wikilinks := $content | findRE "\\[\\[[^\\[\\]\\|]*(?:\\|[^\\[\\]]*)?\\]\\]" }}
+{{range $wikilinks}}
+ {{$inner := . | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }}
+ {{$split := split $inner "|"}}
+ {{$path := index $split 0}}
+ {{$reference := split $path "#"}}
+ {{$title := index $reference 0}}
+ {{$block := default "" (index $reference 1)}}
+ {{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block))}}
+ {{$href := strings.TrimRight "/" ($page.GetPage $title).RelPermalink}}
+ {{$display := default $title (index $split 1)}}
+ {{if not $href}}
+ {{$link := printf "
%s" $display}}
+ {{ $content = replace $content . $link }}
+ {{else}}
+ {{$fullhref := printf "%s%s" $href $block }}
+ {{$link := printf "
%s" $fullhref $href $display}}
+ {{ $content = replace $content . $link }}
+ {{end}}
+{{end}}
+{{ $content | safeHTML }}