aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-03-14 15:07:16 -0700
committerJohn MacFarlane <[email protected]>2025-03-14 15:07:16 -0700
commit28eca1e41e32a4f76645df6ea6de4f746a9e3e62 (patch)
tree983e132a6d335375054445e5e966fb3624bc6c6e /src
parent7301daa799830065e8a69a03cebd756f8317bbea (diff)
Markdown reader: remove some misguided list fanciness.
Previously we tried to handle things like commented out list items: - one <!-- - two --> - three and also things like: - one `and - two` and But the code we added to handle these cases caused problems with other, more straightforward things, like: - one - ``` code ``` - three So we are rolling back all the fanciness, so that the markdown parser now behaves more like the commonmark parser, in which indicators of block-level structure always take priority over indicators of inline structure. Closes #9865. Closes #7778. See also #5628.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index d73bed229..a4677ec07 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -49,7 +49,7 @@ import Text.Pandoc.Options
import Text.Pandoc.Walk (walk)
import Text.Pandoc.Parsing hiding (tableCaption)
import Text.Pandoc.Readers.HTML (htmlInBalanced, htmlTag, isBlockTag,
- isCommentTag, isInlineTag, isTextTag)
+ isInlineTag, isTextTag)
import Text.Pandoc.Readers.LaTeX (applyMacros, rawLaTeXBlock, rawLaTeXInline)
import Text.Pandoc.Shared
import Text.Pandoc.URI (escapeURI, isURI, pBase64DataURI)
@@ -855,15 +855,7 @@ listLine continuationIndent = try $ do
notFollowedByHtmlCloser
notFollowedByDivCloser
optional (() <$ gobbleSpaces continuationIndent)
- listLineCommon
-
-listLineCommon :: PandocMonad m => MarkdownParser m Text
-listLineCommon = T.concat <$> manyTill
- ( many1Char (satisfy $ \c -> c `notElem` ['\n', '<', '`'])
- <|> fmap snd (withRaw code)
- <|> fmap (renderTags . (:[]) . fst) (htmlTag isCommentTag)
- <|> countChar 1 anyChar
- ) newline
+ anyLine
-- parse raw text for one list item, excluding start marker and continuations
rawListItem :: PandocMonad m
@@ -877,7 +869,7 @@ rawListItem fourSpaceRule start = try $ do
let continuationIndent = if fourSpaceRule
then 4
else sourceColumn pos2 - sourceColumn pos1
- first <- listLineCommon
+ first <- anyLine
rest <- many (do notFollowedBy listStart
notFollowedBy (() <$ codeBlockFenced)
notFollowedBy blankline