Ensure proper nesting when we have long ordered list markers.

Closes #5705.
This commit is contained in:
John MacFarlane 2019-08-23 09:16:31 -07:00
parent 9b5082b086
commit 1c71bd1ff5
2 changed files with 16 additions and 2 deletions

View file

@ -768,15 +768,18 @@ orderedListItemToMarkdown :: PandocMonad m
orderedListItemToMarkdown opts marker bs = do
let exts = writerExtensions opts
contents <- blockListToMarkdown opts $ taskListItemToAscii exts bs
let sps = case length marker - writerTabStop opts of
let sps = case writerTabStop opts - length marker of
n | n > 0 -> text $ replicate n ' '
_ -> text " "
let ind = if isEnabled Ext_four_space_rule opts
then writerTabStop opts
else max (writerTabStop opts) (length marker + 1)
let start = text marker <> sps
-- remove trailing blank line if item ends with a tight list
let contents' = if itemEndsWithTightList bs
then chomp contents <> cr
else contents
return $ hang (writerTabStop opts) start $ contents' <> cr
return $ hang ind start $ contents' <> cr
-- | Convert definition list item (label, list of blocks) to markdown.
definitionListItemToMarkdown :: PandocMonad m

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

@ -0,0 +1,11 @@
```
% pandoc -f native -t markdown
[OrderedList (8,UpperRoman,Period)
[[Plain [Str "Blah"]
,BulletList
[[Plain [Str "Blah"]]]]]]
^D
VIII. Blah
- Blah
```