From c5bab883ec8ea64f5fe56f1fd6be66e31dd9a86a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 9 Oct 2024 08:54:27 -0700 Subject: [PATCH] RST reader: ignore newlines in URL in explicit link. Closes #10279. --- src/Text/Pandoc/Readers/RST.hs | 4 +++- test/command/10279.md | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/command/10279.md diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index ce8a83628f90..52b0b2544189 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -1604,7 +1604,9 @@ explicitLink = try $ do notFollowedBy (char '`') -- `` marks start of inline code label' <- trimInlines . mconcat <$> manyTill (notFollowedBy (char '`') >> inlineContent) (char '<') - src <- trim <$> manyTillChar (noneOf ">\n") (char '>') + src <- trim . T.pack . filter (/= '\n') <$> -- see #10279 + manyTill (noneOf ">\n" <|> (char '\n' <* notFollowedBy blankline)) + (char '>') skipSpaces string "`_" optional $ char '_' -- anonymous form diff --git a/test/command/10279.md b/test/command/10279.md new file mode 100644 index 000000000000..5029c419442c --- /dev/null +++ b/test/command/10279.md @@ -0,0 +1,9 @@ +``` +% pandoc -f rst +See `the full compatibility guidelines `_ for more information. +^D +

See the full compatibility +guidelines for more information.

+ +```