From 2a15d2c7176462ca55d1852813c050bfc70aaa5f702aa6365f3ad76fc4085772 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Fri, 16 Aug 2024 00:00:00 +0000 Subject: Fix bug in bold/italics regex Bold/italics regex must not match greedily. --- layouts/_default/single.gmi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'layouts') 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 -}} -- cgit v1.2.3