git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: Update definition lists.
18d72a0John MacFarlane
src/Text/Pandoc/Writers/Markdown.hs+13−2
@@ -610,8 +610,19 @@ definitionListItemToMarkdown opts (label, defs) = do
610 let sps = case writerTabStop opts - 3 of
610 let sps = case writerTabStop opts - 3 of
611 n | n > 0 -> text $ replicate n ' '
611 n | n > 0 -> text $ replicate n ' '
612 _ -> text " "
612 _ -> text " "
613+ if isEnabled Ext_compact_definition_lists opts
614+ then do
613− let contents = vcat $ map (\d -> hang tabStop (leader <> sps) $ vcat d <> cr) defs'
615+ let contents = vcat $ map (\d -> hang tabStop (leader <> sps)
616+ $ vcat d <> cr) defs'
617+ return $ nowrap labelText <> cr <> contents <> cr
618+ else do
619+ let contents = vcat $ map (\d -> hang tabStop (leader <> sps)
620+ $ vcat d <> cr) defs'
621+ let isTight = case defs of
622+ ((Plain _ : _): _) -> True
623+ _ -> False
614− return $ nowrap labelText <> cr <> contents <> cr
624+ return $ blankline <> nowrap labelText <>
625+ (if isTight then cr else blankline) <> contents <> blankline
615 else do
626 else do
616 return $ nowrap labelText <> text " " <> cr <>
627 return $ nowrap labelText <> text " " <> cr <>
617 vsep (map vsep defs') <> blankline
628 vsep (map vsep defs') <> blankline