aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-08-23 09:16:31 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-08-23 09:16:54 -0700
commit1c71bd1ff549737663ddf84e33276ddf8e926b39 (patch)
treec1e349ed420025c894da341ed9f7be7ca5ac9357 /src/Text/Pandoc
parent9b5082b086359a63b92bdb40166fa59dea27afe1 (diff)
downloadpandoc-1c71bd1ff549737663ddf84e33276ddf8e926b39.tar.gz
Ensure proper nesting when we have long ordered list markers.
Closes #5705.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 23d0341da..7f30edf1f 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -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