Commonmark/markua/gfm writers: avoid excessive indentation...

on bullet lists.  They are now nested by 2 spaces instead of 4.

See #8011.
This commit is contained in:
John MacFarlane 2022-04-08 20:52:02 -07:00
parent 813f3d5dd4
commit 356ece29cb
4 changed files with 16 additions and 16 deletions

View file

@ -684,15 +684,15 @@ bulletListItemToMarkdown opts bs = do
variant <- asks envVariant variant <- asks envVariant
let exts = writerExtensions opts let exts = writerExtensions opts
contents <- blockListToMarkdown opts $ taskListItemToAscii exts bs contents <- blockListToMarkdown opts $ taskListItemToAscii exts bs
let sps = T.replicate (writerTabStop opts - 2) " "
let start = case variant of let start = case variant of
Markua -> literal "* " Markua -> "* "
_ -> literal $ "- " <> sps Commonmark -> "- "
_ -> "- " <> T.replicate (writerTabStop opts - 2) " "
-- remove trailing blank line if item ends with a tight list -- remove trailing blank line if item ends with a tight list
let contents' = if itemEndsWithTightList bs let contents' = if itemEndsWithTightList bs
then chomp contents <> cr then chomp contents <> cr
else contents else contents
return $ hang (writerTabStop opts) start contents' return $ hang (T.length start) (literal start) contents'
-- | Convert ordered list item (a list of blocks) to markdown. -- | Convert ordered list item (a list of blocks) to markdown.
orderedListItemToMarkdown :: PandocMonad m orderedListItemToMarkdown :: PandocMonad m