From 8f15c5f8c1a0650d3c757f8cdf8ea12e4128ee97 Mon Sep 17 00:00:00 2001
From: meleu <meleu@users.noreply.github.com>
Date: Sun, 03 Apr 2022 19:22:32 +0000
Subject: [PATCH] disable ToC if enableToc: false

---
 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 8e4a794..008d163 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -5,7 +5,11 @@
 {{ $content = replace $content "-&gt;" "→" }}
 
 {{/* Escape slashes for Latex to fix line breaks */}}
-{{ $content = replaceRE "\\\\ *\n" "\\\\" $content }}
+{{$latex := findRE "\\$\\$([^\\$]+)\\$\\$" $content}}
+{{range $latex}}
+  {{$fixed := replaceRE "\\\\(?: +|\\n)" "\\\\" .}}
+  {{$content = replace $content . $fixed}}
+{{end}}
 
 {{/* Wikilinks */}}
 {{$wikilinks := $content | findRE "\\[\\[[^\\[\\]\\|]*(?:\\|[^\\[\\]]*)?\\]\\]" }}

--
Gitblit v1.10.0