aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-04-18 10:13:32 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-04-18 10:13:32 -0700
commitd3544dc6f7a2386c4a68a85110f322b50332cfbe (patch)
tree423523d213fa4b89e8a8faff4271bdf3d270f871 /src/Text/Pandoc/Readers
parent10e28ef750f0c7e6bc0dfb7aabaaad8edf059e3c (diff)
downloadpandoc-d3544dc6f7a2386c4a68a85110f322b50332cfbe.tar.gz
Markdown definition lists: don't require indent for first line.
Previously the body of the definition (after the `:` or `~` marker) needed to be in column 4. This commit relaxes that requirement, to better match the behavior of PHP Markdown Extra. So, now this is a valid definition list: foo : bar This patch also helps resolve a potentially ambiguity with table captions: foo : bar ----- table ----- Is "bar" a definition, or the caption for the table? We'll count it as a caption for the table. Closes #2087.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs6
1 files changed, 4 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