diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 11d8c39d7..ed4c27077 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -578,7 +578,10 @@ blockToMarkdown' opts (CodeBlock attribs str) = do
tildes <> attrs <> cr <> literal str <> cr <> tildes <> blankline
_ | variant == Markua -> blankline <> attrsToMarkua opts attribs <> cr <> backticks <> cr <>
literal str <> cr <> backticks <> cr <> blankline
- | otherwise -> nest (writerTabStop opts) (literal str) <> blankline
+ | otherwise -> -- don't use nest: see #11542
+ let addIndent "" = "\n"
+ addIndent x = (T.replicate (writerTabStop opts) " ") <> x <> "\n"
+ in literal (mconcat $ map addIndent (T.lines str)) $$ blankline
where
endlineLen c = maybe 3 ((+1) . maximum) $ nonEmpty
[T.length ln
@@ -862,8 +865,10 @@ definitionListItemToMarkdown opts (label, defs) = do
_ -> ":"
let leadingChars = case tabStop of
-- Always use two leading characters for Markua
- n | n >= 2 && variant /= Markua -> n
- _ -> 2
+ n | variant == Markua -> 2
+ | isEnabled Ext_four_space_rule opts
+ , n >= 2 -> n
+ | otherwise -> 2
let sps = literal $ T.replicate (leadingChars - 1) " "
let isTight = case defs of
((Plain _ : _): _) -> True
diff --git a/test/command/11542.md b/test/command/11542.md
new file mode 100644
index 000000000..793f65e53
--- /dev/null
+++ b/test/command/11542.md
@@ -0,0 +1,47 @@
+```
+% pandoc -f native -t markdown
+[ DefinitionList
+ [ ( [ Str "Input" ]
+ , [ [ CodeBlock ( "" , [] , [] ) "Term\n\n : Def" ] ]
+ )
+ ]
+]
+^D
+Input
+
+: Term
+
+ : Def
+```
+
+```
+% pandoc -f markdown -t native
+Input
+
+: Term
+
+ : Def
+^D
+[ DefinitionList
+ [ ( [ Str "Input" ]
+ , [ [ CodeBlock ( "" , [] , [] ) "Term\n\n : Def" ] ]
+ )
+ ]
+]
+```
+
+```
+% pandoc -f native -t markdown+four_space_rule
+[ DefinitionList
+ [ ( [ Str "Input" ]
+ , [ [ CodeBlock ( "" , [] , [] ) "Term\n\n : Def" ] ]
+ )
+ ]
+]
+^D
+Input
+
+: Term
+
+ : Def
+```
diff --git a/test/command/5543.md b/test/command/5543.md
index 6cae49e66..f3865d758 100644
--- a/test/command/5543.md
+++ b/test/command/5543.md
@@ -4,5 +4,5 @@
: description
^D
1\. item
-: description
+: description
```
diff --git a/test/command/6858.md b/test/command/6858.md
index 3428157ff..e59c2772b 100644
--- a/test/command/6858.md
+++ b/test/command/6858.md
@@ -27,13 +27,13 @@ Module FvwmAnimate \[ModuleAlias\]
\*FvwmAnimate: Color color
-: Tells **FvwmAnimate** what color to draw with. The color is
- \"XOR\'ed\" (exclusive ORed) onto the background.
+: Tells **FvwmAnimate** what color to draw with. The color is
+ \"XOR\'ed\" (exclusive ORed) onto the background.
\*FvwmAnimate: Pixmap pixmap
-: Tells **FvwmAnimate** to use **pixmap** to draw with. This can be
- useful if **\*FvwmAnimate: Color** gives poor results.
+: Tells **FvwmAnimate** to use **pixmap** to draw with. This can be
+ useful if **\*FvwmAnimate: Color** gives poor results.
```
```
diff --git a/test/command/9201.md b/test/command/9201.md
index 12c9aec9e..333f8e35e 100644
--- a/test/command/9201.md
+++ b/test/command/9201.md
@@ -12,7 +12,7 @@ This is line two.
**\--help**
-: This is line one.
+: This is line one.
- This is line two.
+ This is line two.
```
diff --git a/test/writer.markdown b/test/writer.markdown
index 0345da7a1..ebcff0869 100644
--- a/test/writer.markdown
+++ b/test/writer.markdown
@@ -261,93 +261,93 @@ B. Williams
Tight using spaces:
apple
-: red fruit
+: red fruit
orange
-: orange fruit
+: orange fruit
banana
-: yellow fruit
+: yellow fruit
Tight using tabs:
apple
-: red fruit
+: red fruit
orange
-: orange fruit
+: orange fruit
banana
-: yellow fruit
+: yellow fruit
Loose:
apple
-: red fruit
+: red fruit
orange
-: orange fruit
+: orange fruit
banana
-: yellow fruit
+: yellow fruit
Multiple blocks with italics:
*apple*
-: red fruit
+: red fruit
- contains seeds, crisp, pleasant to taste
+ contains seeds, crisp, pleasant to taste
*orange*
-: orange fruit
+: orange fruit
- { orange code block }
+ { orange code block }
- > orange block quote
+ > orange block quote
Multiple definitions, tight:
apple
-: red fruit
-: computer
+: red fruit
+: computer
orange
-: orange fruit
-: bank
+: orange fruit
+: bank
Multiple definitions, loose:
apple
-: red fruit
+: red fruit
-: computer
+: computer
orange
-: orange fruit
+: orange fruit
-: bank
+: bank
Blank line after term, indented marker, alternate markers:
apple
-: red fruit
+: red fruit
-: computer
+: computer
orange
-: orange fruit
+: orange fruit
- 1. sublist
- 2. sublist
+ 1. sublist
+ 2. sublist
# HTML Blocks
diff --git a/test/writer.opml b/test/writer.opml
index b2fef8fc8..9ccbb422b 100644
--- a/test/writer.opml
+++ b/test/writer.opml
@@ -42,7 +42,7 @@
-
+
diff --git a/test/writer.plain b/test/writer.plain
index 814f40776..effe47eb7 100644
--- a/test/writer.plain
+++ b/test/writer.plain
@@ -257,93 +257,93 @@ Definition Lists
Tight using spaces:
apple
- red fruit
+ red fruit
orange
- orange fruit
+ orange fruit
banana
- yellow fruit
+ yellow fruit
Tight using tabs:
apple
- red fruit
+ red fruit
orange
- orange fruit
+ orange fruit
banana
- yellow fruit
+ yellow fruit
Loose:
apple
- red fruit
+ red fruit
orange
- orange fruit
+ orange fruit
banana
- yellow fruit
+ yellow fruit
Multiple blocks with italics:
apple
- red fruit
+ red fruit
- contains seeds, crisp, pleasant to taste
+ contains seeds, crisp, pleasant to taste
orange
- orange fruit
+ orange fruit
- { orange code block }
+ { orange code block }
- orange block quote
+ orange block quote
Multiple definitions, tight:
apple
- red fruit
- computer
+ red fruit
+ computer
orange
- orange fruit
- bank
+ orange fruit
+ bank
Multiple definitions, loose:
apple
- red fruit
+ red fruit
- computer
+ computer
orange
- orange fruit
+ orange fruit
- bank
+ bank
Blank line after term, indented marker, alternate markers:
apple
- red fruit
+ red fruit
- computer
+ computer
orange
- orange fruit
+ orange fruit
- 1. sublist
- 2. sublist
+ 1. sublist
+ 2. sublist
HTML Blocks