From 598d3ee23b708634ac8526cdc03291f17803eb2a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 31 Aug 2014 12:55:47 -0700 Subject: Markdown reader: better handling of paragraph in div. Previously text that ended a div would be parsed as Plain unless there was a blank line before the closing div tag. Test case:
This is a paragraph. This is another paragraph.
Closes #1591. --- src/Text/Pandoc/Readers/Markdown.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 6b7f1a8fb..02a787670 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -927,6 +927,12 @@ para = try $ do <|> (guardDisabled Ext_blank_before_header >> () <$ lookAhead header) <|> (guardEnabled Ext_lists_without_preceding_blankline >> () <$ lookAhead listStart) + <|> do guardEnabled Ext_native_divs + inHtmlBlock <- stateInHtmlBlock <$> getState + case inHtmlBlock of + Just "div" -> () <$ + lookAhead (htmlTag (~== TagClose "div")) + _ -> mzero return $ do result' <- result case B.toList result' of @@ -1611,6 +1617,7 @@ endline = try $ do guardEnabled Ext_blank_before_header <|> notFollowedBy (char '#') -- atx header guardDisabled Ext_backtick_code_blocks <|> notFollowedBy (() <$ (lookAhead (char '`') >> codeBlockFenced)) + notFollowedByHtmlCloser (eof >> return mempty) <|> (guardEnabled Ext_hard_line_breaks >> return (return B.linebreak)) <|> (guardEnabled Ext_ignore_line_breaks >> return mempty) -- cgit v1.2.3