From de2b6b9a1b95cb6af7eb421d9a4de054e7e41315 Mon Sep 17 00:00:00 2001
From: SafEight <43656822+SafEight@users.noreply.github.com>
Date: Sat, 19 Nov 2022 21:17:55 +0000
Subject: [PATCH] feat: Replace == with <mark> (#234)

---
 assets/styles/custom.scss            |    2 ++
 assets/styles/base.scss              |    4 ++++
 layouts/partials/textprocessing.html |    7 +++++++
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/assets/styles/base.scss b/assets/styles/base.scss
index 8bd97ef..80e29de 100644
--- a/assets/styles/base.scss
+++ b/assets/styles/base.scss
@@ -619,3 +619,7 @@
   }
 }
 
+mark {
+  background-color: var(--highlighted);
+  color: var(--gray);
+}
diff --git a/assets/styles/custom.scss b/assets/styles/custom.scss
index a7a2e79..fc0108a 100644
--- a/assets/styles/custom.scss
+++ b/assets/styles/custom.scss
@@ -11,6 +11,7 @@
   --lightgray: #f0f0f0;
   --outlinegray: #dadada;
   --million-progress-bar-color: var(--secondary);
+  --highlighted: #f5dfaf88;
 }
 
 [saved-theme="dark"] {
@@ -23,6 +24,7 @@
   --gray: #d4d4d4 !important;
   --lightgray: #292633 !important;
   --outlinegray: #343434 !important;
+  --highlighted: #574010;
 }
 
 
diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
index 6776fa5..bd2cca5 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -96,4 +96,11 @@
   {{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }}
 {{end}}
 
+{{/* Make ==text== into <mark>text</mark> */}}
+{{$mark := findRE "(?Us)==([^\\$]+)==" $content}}
+{{range $mark}}
+  {{$fixed := printf "<mark>%s</mark>" (replace . "==" "")}}
+  {{$content = replace $content . $fixed}}
+{{end}}
+
 {{ $content | safeHTML }}

--
Gitblit v1.10.0