diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 3 | ||||
-rw-r--r-- | tests/markdown-reader-more.native | 2 | ||||
-rw-r--r-- | tests/markdown-reader-more.txt | 4 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index cc5521a62..e697febf6 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -177,9 +177,10 @@ charsInBalancedBrackets openBrackets = (char '[' >> charsInBalancedBrackets (openBrackets + 1)) <|> (char ']' >> charsInBalancedBrackets (openBrackets - 1)) <|> (( (() <$ code) - <|> (() <$ escapedChar') + <|> (() <$ (escapedChar')) <|> (newline >> notFollowedBy blankline) <|> skipMany1 (noneOf "[]`\n\\") + <|> (() <$ count 1 (oneOf "`\\")) ) >> charsInBalancedBrackets openBrackets) -- diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native index 96204898e..8fee4953e 100644 --- a/tests/markdown-reader-more.native +++ b/tests/markdown-reader-more.native @@ -150,6 +150,8 @@ ,Para [Link [Str "link"] ("/hi(there)","")] ,Para [Link [Str "link"] ("/hithere)","")] ,Para [Link [Str "linky"] ("hi_(there_(nested))","")] +,Header 2 ("backslashes-in-link-references",[],[]) [Str "Backslashes",Space,Str "in",Space,Str "link",Space,Str "references"] +,Para [Link [Str "*",RawInline (Format "tex") "\\a"] ("b","")] ,Header 2 ("reference-link-fallbacks",[],[]) [Str "Reference",Space,Str "link",Space,Str "fallbacks"] ,Para [Str "[",Emph [Str "not",Space,Str "a",Space,Str "link"],Str "]",Space,Str "[",Emph [Str "nope"],Str "]\8230"] ,Header 2 ("reference-link-followed-by-a-citation",[],[]) [Str "Reference",Space,Str "link",Space,Str "followed",Space,Str "by",Space,Str "a",Space,Str "citation"] diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt index 99e9ec7e8..4a476adf0 100644 --- a/tests/markdown-reader-more.txt +++ b/tests/markdown-reader-more.txt @@ -258,6 +258,10 @@ Empty cells [linky]: hi_(there_(nested)) +## Backslashes in link references + +[\*\a](b) + ## Reference link fallbacks [*not a link*] [*nope*]... |