aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs15
-rw-r--r--test/command/10890.md15
-rw-r--r--test/writer.markua14
3 files changed, 30 insertions, 14 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 39abed8fa..cd3e4ab91 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -857,17 +857,18 @@ definitionListItemToMarkdown opts (label, defs) = do
let tabStop = writerTabStop opts
variant <- asks envVariant
let leader = case variant of
- PlainText -> " "
- Markua -> ":"
- _ -> ": "
- let sps = case writerTabStop opts - 3 of
- n | n > 0 -> literal $ T.replicate n " "
- _ -> literal " "
+ PlainText -> " "
+ _ -> ":"
+ let leadingChars = case tabStop of
+ -- Always use two leading characters for Markua
+ n | n >= 2 && variant /= Markua -> n
+ _ -> 2
+ let sps = literal $ T.replicate (leadingChars - 1) " "
let isTight = case defs of
((Plain _ : _): _) -> True
_ -> False
let contents = (if isTight then vcat else vsep) $ map
- (\d -> hang tabStop (leader <> sps) $ vcat d)
+ (\d -> hang leadingChars (leader <> sps) $ vcat d)
defs'
return $ blankline <> nowrap labelText $$
(if isTight then empty else blankline) <> contents <> blankline
diff --git a/test/command/10890.md b/test/command/10890.md
new file mode 100644
index 000000000..508a9a3d2
--- /dev/null
+++ b/test/command/10890.md
@@ -0,0 +1,15 @@
+```
+% pandoc --tab-stop=2 --from=native --to=markdown
+[ DefinitionList
+ [ ( [ Str "apple" ]
+ , [ [ Para [ Str "pomaceous" ] , Para [ Str "fruit" ] ] ]
+ )
+ ]
+]
+^D
+apple
+
+: pomaceous
+
+ fruit
+```
diff --git a/test/writer.markua b/test/writer.markua
index a7032dc27..c1ca713d9 100644
--- a/test/writer.markua
+++ b/test/writer.markua
@@ -317,17 +317,17 @@ Multiple blocks with italics:
: red fruit
- contains seeds, crisp, pleasant to taste
+ contains seeds, crisp, pleasant to taste
*orange*
: orange fruit
- ```
- { orange code block }
- ```
+ ```
+ { orange code block }
+ ```
- > orange block quote
+ > orange block quote
Multiple definitions, tight:
@@ -365,8 +365,8 @@ orange
: orange fruit
- 1. sublist
- 2. sublist
+ 1. sublist
+ 2. sublist
{id: html-blocks}
# HTML Blocks