Fix code blocks using --preserve-tabs.

Previously they did not behave as the equivalent input
with spaces would.  Closes #7573.
This commit is contained in:
John MacFarlane 2021-09-16 20:42:18 -07:00
parent 7c22c0202e
commit a07d955d6f
2 changed files with 18 additions and 1 deletions

View file

@ -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

11
test/command/7573.md Normal file
View file

@ -0,0 +1,11 @@
```
% pandoc --preserve-tabs
<ol>
<li>one
</ol>
^D
<ol>
<li>
one
</ol>
```