diff --git a/assets/js/popover.js b/assets/js/popover.js
index 3d0d18b1..83cdc03d 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 5dc0b48a..e4692d73 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 21e70664..c09f2dcf 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 75b24bf8..d449c273 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 00000000..8e4a794f
--- /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 }}