diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 6 | ||||
-rw-r--r-- | tests/Tests/Readers/Markdown.hs | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 5e0cef4f8..17270b741 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -880,7 +880,7 @@ defListMarker = do tabStop <- getOption readerTabStop let remaining = tabStop - (length sps + 1) if remaining > 0 - then count remaining (char ' ') <|> string "\t" + then try (count remaining (char ' ')) <|> string "\t" <|> many1 spaceChar else mzero return () @@ -916,7 +916,9 @@ defRawBlock compact = try $ do definitionList :: MarkdownParser Blocks definitionList = try $ do - lookAhead (anyLine >> optional blankline >> defListMarker) + lookAhead (anyLine >> optional (blankline >> notFollowedBy table) >> + -- don't capture table caption as def list! + defListMarker) compactDefinitionList <|> normalDefinitionList compactDefinitionList :: MarkdownParser Blocks diff --git a/tests/Tests/Readers/Markdown.hs b/tests/Tests/Readers/Markdown.hs index 8965d1d6e..aaeefcfa4 100644 --- a/tests/Tests/Readers/Markdown.hs +++ b/tests/Tests/Readers/Markdown.hs @@ -270,6 +270,9 @@ tests = [ testGroup "inline code" definitionList [ (text "foo1", [para (text "bar") <> para (text "baz")]) ] + , "first line not indented" =: + "foo\n: bar\n" =?> + definitionList [ (text "foo", [plain (text "bar")]) ] ] , testGroup "+compact_definition_lists" [ test markdownCDL "basic compact list" $ |