aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-11-03 17:09:34 +0100
committerJohn MacFarlane <[email protected]>2025-11-03 17:09:34 +0100
commita7778c80f3c6a09f728904a93d585c0c955dc447 (patch)
tree8728daac5dba2a461a84ae5eeab3bc6ca4720371 /src
parentc04c5ad16db638b946b7510f5466f1dc96534f2e (diff)
Markdown reader: fix performance issue in links with `'`.
Closes #10880.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 3fee1c57a..1ee1b801e 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1826,9 +1826,9 @@ source = do
return $ "(" <> result <> ")"
let linkTitle' = try $ spnl >> linkTitle
let urlChunk = do
- notFollowedBy linkTitle'
try parenthesizedChars
- <|> (notFollowedBy (oneOf " )") >> litChar)
+ <|> (notFollowedBy (oneOf "\n\r )") >> litChar)
+ <|> (lookAhead (oneOf "\n\r") >> notFollowedBy linkTitle' >> litChar)
<|> try (many1Char spaceChar <* notFollowedBy (oneOf "\"')"))
let sourceURL = T.unwords . T.words . T.concat <$> many urlChunk
src <- try (litBetween '<' '>') <|> try base64DataURI <|> sourceURL