git.iko.soy/typeable/pandoc
on master help sign in
Ensure proper nesting when we have long ordered list markers.
1c71bd1John MacFarlane
src/Text/Pandoc/Writers/Markdown.hs+5−2
@@ -768,15 +768,18 @@ orderedListItemToMarkdown :: PandocMonad m
768orderedListItemToMarkdown opts marker bs = do
768orderedListItemToMarkdown opts marker bs = do
769 let exts = writerExtensions opts
769 let exts = writerExtensions opts
770 contents <- blockListToMarkdown opts $ taskListItemToAscii exts bs
770 contents <- blockListToMarkdown opts $ taskListItemToAscii exts bs
771− let sps = case length marker - writerTabStop opts of
771+ let sps = case writerTabStop opts - length marker of
772 n | n > 0 -> text $ replicate n ' '
772 n | n > 0 -> text $ replicate n ' '
773 _ -> text " "
773 _ -> text " "
774+ let ind = if isEnabled Ext_four_space_rule opts
775+ then writerTabStop opts
776+ else max (writerTabStop opts) (length marker + 1)
774 let start = text marker <> sps
777 let start = text marker <> sps
775 -- remove trailing blank line if item ends with a tight list
778 -- remove trailing blank line if item ends with a tight list
776 let contents' = if itemEndsWithTightList bs
779 let contents' = if itemEndsWithTightList bs
777 then chomp contents <> cr
780 then chomp contents <> cr
778 else contents
781 else contents
779− return $ hang (writerTabStop opts) start $ contents' <> cr
782+ return $ hang ind start $ contents' <> cr
780
783
781-- | Convert definition list item (label, list of blocks) to markdown.
784-- | Convert definition list item (label, list of blocks) to markdown.
782definitionListItemToMarkdown :: PandocMonad m
785definitionListItemToMarkdown :: PandocMonad m
test/command/5705.mdnew file+11
@@ -0,0 +1,11 @@
1+```
2+% pandoc -f native -t markdown
3+[OrderedList (8,UpperRoman,Period)
4+ [[Plain [Str "Blah"]
5+ ,BulletList
6+ [[Plain [Str "Blah"]]]]]]
7+^D
8+VIII. Blah
9+ - Blah
10+```
11+