aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <mail@nicholasjohnson.ch>2024-08-16 00:00:00 +0000
committerNicholas Johnson <mail@nicholasjohnson.ch>2024-08-16 00:00:00 +0000
commit2a15d2c7176462ca55d1852813c050bfc70aaa5f702aa6365f3ad76fc4085772 (patch)
tree4577cd844ef126a88ba659f44dcb31176ada014d2a8f3f3465b816679bea5312
parentd3dea501504892f248864c851f7cf7367d63451c96b5e54daa085cb85aad1837 (diff)
downloadhugo-theme-journal-2a15d2c7176462ca55d1852813c050bfc70aaa5f702aa6365f3ad76fc4085772.tar.gz
hugo-theme-journal-2a15d2c7176462ca55d1852813c050bfc70aaa5f702aa6365f3ad76fc4085772.zip
Fix bug in bold/italics regex
Bold/italics regex must not match greedily.
-rw-r--r--layouts/_default/single.gmi6
1 files changed, 3 insertions, 3 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
index 5c470ab..2064bdd 100644
--- a/layouts/_default/single.gmi
+++ b/layouts/_default/single.gmi
@@ -90,9 +90,9 @@
{{/* remove bold and italics asterisk symbols */ -}}
{{/* note: this operation is performed in 3 steps to handle nested bold and italics */ -}}
{{/* note: this operation is performed last to avoid incorrectly rendering (un)ordered lists */ -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S(?:.*\S)?)\*{3}` "$1" -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S(?:.*\S)?)\*{2}` "$1" -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{1}(\S(?:.*\S)?)\*{1}` "$1" -}}
+ {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S(?:.*?\S)?)\*{3}` "$1" -}}
+ {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S(?:.*?\S)?)\*{2}` "$1" -}}
+ {{ $rendered_text = $rendered_text | replaceRE `\*{1}(\S(?:.*?\S)?)\*{1}` "$1" -}}
{{ $rendered_text = $rendered_text | emojify -}}