From f9bbbf6f402edfac34db5482c9c5d9c4f230b875 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Thu, 4 May 2023 11:47:53 +0200 Subject: [PATCH] Markdown reader: disallow escaping of `~` and `"` in markdown_strict This matches the behavior of the legacy `markdown.pl` as well as what is described in the manual. Fixes: #8777 --- src/Text/Pandoc/Readers/Markdown.hs | 2 +- test/command/8777.md | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/command/8777.md diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index e0c0922cb..6038ecab1 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1556,7 +1556,7 @@ escapedChar' = try $ do (guardEnabled Ext_all_symbols_escapable >> satisfy (not . isAlphaNum)) <|> (guardEnabled Ext_angle_brackets_escapable >> oneOf "\\`*_{}[]()>#+-.!~\"<>") - <|> oneOf "\\`*_{}[]()>#+-.!~\"" + <|> oneOf "\\`*_{}[]()>#+-.!" escapedNewline :: PandocMonad m => MarkdownParser m (F Inlines) escapedNewline = do diff --git a/test/command/8777.md b/test/command/8777.md new file mode 100644 index 000000000..56f5db07c --- /dev/null +++ b/test/command/8777.md @@ -0,0 +1,8 @@ +# Backslash escapes in markdown_strict + +``` +% pandoc --from=markdown_strict -t html +These are not escaped: \~ \" +^D +

These are not escaped: \~ \"

+```