summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-11-28 23:14:31 +0000
committerAndreas Kling <kling@serenityos.org>2020-11-29 10:45:00 +0100
commitb5b4c5091373acbd1c15c94212b0274545e2a9d4 (patch)
tree0cf050fdc00ba0fb34e33216f4e74407a249b261
parenta34939bcd54da99056d2ed11cf2840624f1322e5 (diff)
downloadserenity-b5b4c5091373acbd1c15c94212b0274545e2a9d4.zip
LibMarkdown: Only consider "!" a special character when followed by "["
Fixes #4220.
-rw-r--r--Libraries/LibMarkdown/Text.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/Libraries/LibMarkdown/Text.cpp b/Libraries/LibMarkdown/Text.cpp
index 6d0de5bca2..75273e3a8f 100644
--- a/Libraries/LibMarkdown/Text.cpp
+++ b/Libraries/LibMarkdown/Text.cpp
@@ -220,7 +220,7 @@ Optional<Text> Text::parse(const StringView& str)
bool is_special_character = false;
is_special_character |= ch == '`';
if (!current_style.code)
- is_special_character |= ch == '*' || ch == '_' || ch == '[' || ch == ']' || ch == '!';
+ is_special_character |= ch == '*' || ch == '_' || ch == '[' || ch == ']' || (ch == '!' && offset + 1 < str.length() && str[offset + 1] == '[');
if (!is_special_character)
continue;
@@ -240,8 +240,6 @@ Optional<Text> Text::parse(const StringView& str)
}
break;
case '!':
- if (offset + 1 >= str.length() || str[offset + 1] != '[')
- continue;
current_link_is_actually_img = true;
break;
case '[':