From b5b4c5091373acbd1c15c94212b0274545e2a9d4 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 28 Nov 2020 23:14:31 +0000 Subject: LibMarkdown: Only consider "!" a special character when followed by "[" Fixes #4220. --- Libraries/LibMarkdown/Text.cpp | 4 +--- 1 file changed, 1 insertion(+), 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::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::parse(const StringView& str) } break; case '!': - if (offset + 1 >= str.length() || str[offset + 1] != '[') - continue; current_link_is_actually_img = true; break; case '[': -- cgit v1.2.3