Markdown writer: Update definition lists.
They now behave like the new reader does. The old behavior can be activated with the `compact_definition_lists` extension.
This commit is contained in:
parent
b104db4fb4
commit
18d72a0768
1 changed files with 13 additions and 2 deletions
|
@ -610,8 +610,19 @@ definitionListItemToMarkdown opts (label, defs) = do
|
||||||
let sps = case writerTabStop opts - 3 of
|
let sps = case writerTabStop opts - 3 of
|
||||||
n | n > 0 -> text $ replicate n ' '
|
n | n > 0 -> text $ replicate n ' '
|
||||||
_ -> text " "
|
_ -> text " "
|
||||||
let contents = vcat $ map (\d -> hang tabStop (leader <> sps) $ vcat d <> cr) defs'
|
if isEnabled Ext_compact_definition_lists opts
|
||||||
return $ nowrap labelText <> cr <> contents <> cr
|
then do
|
||||||
|
let contents = vcat $ map (\d -> hang tabStop (leader <> sps)
|
||||||
|
$ vcat d <> cr) defs'
|
||||||
|
return $ nowrap labelText <> cr <> contents <> cr
|
||||||
|
else do
|
||||||
|
let contents = vcat $ map (\d -> hang tabStop (leader <> sps)
|
||||||
|
$ vcat d <> cr) defs'
|
||||||
|
let isTight = case defs of
|
||||||
|
((Plain _ : _): _) -> True
|
||||||
|
_ -> False
|
||||||
|
return $ blankline <> nowrap labelText <>
|
||||||
|
(if isTight then cr else blankline) <> contents <> blankline
|
||||||
else do
|
else do
|
||||||
return $ nowrap labelText <> text " " <> cr <>
|
return $ nowrap labelText <> text " " <> cr <>
|
||||||
vsep (map vsep defs') <> blankline
|
vsep (map vsep defs') <> blankline
|
||||||
|
|
Loading…
Add table
Reference in a new issue