git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: Separate adjacent lists of the same kind with comment.

Closes #1458.

commit19109331df6ec4373b6b525ccffb5aebb99331a4 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 27 Jul 2014, 08:26 (12 years ago) parentc302ab3
1 file changed+9−3
src/Text/Pandoc/Writers/Markdown.hs+9−3
src/Text/Pandoc/Writers/Markdown.hs+9−3
@@ -623,15 +623,21 @@ blockListToMarkdown opts blocks =
623623 -- code block will be treated as a list continuation paragraph
624624 where fixBlocks (b : CodeBlock attr x : rest)
625625 | (not (isEnabled Ext_fenced_code_blocks opts) || attr == nullAttr)
626− && isListBlock b =
627− b : RawBlock "html" "<!-- -->\n" : CodeBlock attr x :
628− fixBlocks rest
626+ && isListBlock b = b : commentSep : CodeBlock attr x :
627+ fixBlocks rest
628+ fixBlocks (b1@(BulletList _) : b2@(BulletList _) : bs) =
629+ b1 : commentSep : fixBlocks (b2:bs)
630+ fixBlocks (b1@(OrderedList _ _) : b2@(OrderedList _ _) : bs) =
631+ b1 : commentSep : fixBlocks (b2:bs)
632+ fixBlocks (b1@(DefinitionList _) : b2@(DefinitionList _) : bs) =
633+ b1 : commentSep : fixBlocks (b2:bs)
629634 fixBlocks (x : xs) = x : fixBlocks xs
630635 fixBlocks [] = []
631636 isListBlock (BulletList _) = True
632637 isListBlock (OrderedList _ _) = True
633638 isListBlock (DefinitionList _) = True
634639 isListBlock _ = False
640+ commentSep = RawBlock "html" "<!-- -->\n"
635641
636642-- | Get reference for target; if none exists, create unique one and return.
637643-- Prefer label if possible; otherwise, generate a unique key.