Skip to content

Commit 26bc32e

Browse files
m000christopherkenny
authored andcommitted
Plain writer: Support the four_space_rule extension. (jgm#10813)
Allows using `-t plain+four_space_rule` to emulate the output of pandoc before jgm#7172. This is useful for users that use pandoc e.g. to autoformat commit messages.
1 parent 7f6aa67 commit 26bc32e

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/Text/Pandoc/Writers/Markdown.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,9 @@ bulletListItemToMarkdown opts bs = do
794794
Markdown
795795
| isEnabled Ext_four_space_rule opts
796796
-> "- " <> T.replicate (writerTabStop opts - 2) " "
797+
PlainText
798+
| isEnabled Ext_four_space_rule opts
799+
-> "- " <> T.replicate (writerTabStop opts - 2) " "
797800
_ -> "- "
798801
-- remove trailing blank line if item ends with a tight list
799802
let contents' = if itemEndsWithTightList bs

test/command/10812.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Check that the `four_space_rule` extension works for plain writer.
2+
3+
```
4+
% pandoc -f markdown -t plain+four_space_rule
5+
This is the title
6+
7+
Here we fix:
8+
9+
- a
10+
- b
11+
- c
12+
^D
13+
This is the title
14+
15+
Here we fix:
16+
17+
- a
18+
- b
19+
- c
20+
```
21+
22+
Check that the `four_space_rule` extension is off by default.
23+
24+
```
25+
% pandoc -f markdown -t plain
26+
This is the title
27+
28+
Here we fix:
29+
30+
- a
31+
- b
32+
- c
33+
^D
34+
This is the title
35+
36+
Here we fix:
37+
38+
- a
39+
- b
40+
- c
41+
```

0 commit comments

Comments
 (0)