@@ -366,7 +366,19 @@ blockListToMarkdown :: WriterOptions -- ^ Options
366 -> [Block] -- ^ List of block elements
366 -> [Block] -- ^ List of block elements
367 -> State WriterState Doc
367 -> State WriterState Doc
368blockListToMarkdown opts blocks =
368blockListToMarkdown opts blocks =
369− mapM (blockToMarkdown opts) blocks >>= return . cat
369+ mapM (blockToMarkdown opts) (fixBlocks blocks) >>= return . cat
370+ -- insert comment between list and indented code block, or the
371+ -- code block will be treated as a list continuation paragraph
372+ where fixBlocks (b : CodeBlock attr x : rest)
373+ | (writerStrictMarkdown opts || attr == nullAttr) && isListBlock b =
374+ b : RawBlock "html" "<!-- -->\n" : CodeBlock attr x :
376+ fixBlocks (x : xs) = x : fixBlocks xs
378+ isListBlock (BulletList _) = True
379+ isListBlock (OrderedList _ _) = True
380+ isListBlock (DefinitionList _) = True
381+ isListBlock _ = False
371-- | Get reference for target; if none exists, create unique one and return.
383-- | Get reference for target; if none exists, create unique one and return.
372-- Prefer label if possible; otherwise, generate a unique key.
384-- Prefer label if possible; otherwise, generate a unique key.