aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-09-16 20:42:18 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-09-16 20:46:05 -0700
commita07d955d6f96e78ade3e09c150ce580fb6e6f3a7 (patch)
tree5f82883787dba70854bacf7566c840086890e2c8 /src/Text/Pandoc/Readers
parent7c22c0202e8ed706d33f301e65f0aa1a847b4ec4 (diff)
downloadpandoc-a07d955d6f96e78ade3e09c150ce580fb6e6f3a7.tar.gz
Fix code blocks using `--preserve-tabs`.
Previously they did not behave as the equivalent input with spaces would. Closes #7573.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 45594e0fa..917eef287 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1124,7 +1124,13 @@ rawHtmlBlocks = do
let selfClosing = "/>" `T.isSuffixOf` raw
-- we don't want '<td> text' to be a code block:
skipMany spaceChar
- indentlevel <- (blankline >> length <$> many (char ' ')) <|> return 0
+ tabStop <- getOption readerTabStop
+ indentlevel <- option 0 $
+ do blankline
+ foldr (+) 0 <$>
+ many ( (1 <$ char ' ')
+ <|>
+ (tabStop <$ char '\t') )
-- try to find closing tag
-- we set stateInHtmlBlock so that closing tags that can be either block or
-- inline will not be parsed as inline tags