Stop parsing "list lines" when we hit a block tag.
This fixes exponential slowdown in certain input, e.g. a series of lists followed by `</div>`.
This commit is contained in:
parent
eebb15ba1d
commit
5314df51f3
1 changed files with 3 additions and 1 deletions
|
@ -732,7 +732,8 @@ listLine = try $ do
|
|||
notFollowedBy' (do indentSpaces
|
||||
many (spaceChar)
|
||||
listStart)
|
||||
chunks <- manyTill (liftM snd (htmlTag isCommentTag) <|> count 1 anyChar) newline
|
||||
chunks <- manyTill (liftM snd (htmlTag isCommentTag) <|> count 1 (satisfy (/='<'))
|
||||
<|> (notFollowedBy' (htmlTag isBlockTag) >> count 1 anyChar)) newline
|
||||
return $ concat chunks
|
||||
|
||||
-- parse raw text for one list item, excluding start marker and continuations
|
||||
|
@ -759,6 +760,7 @@ listContinuationLine :: MarkdownParser String
|
|||
listContinuationLine = try $ do
|
||||
notFollowedBy blankline
|
||||
notFollowedBy' listStart
|
||||
notFollowedBy' $ try $ skipMany spaceChar >> htmlTag (~== TagClose "div")
|
||||
optional indentSpaces
|
||||
result <- anyLine
|
||||
return $ result ++ "\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue