diff options
| author | Manolis Stamatogiannakis <[email protected]> | 2025-04-29 01:06:31 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-28 16:06:31 -0700 |
| commit | 7f9c776b978458a467a83f662cf8d55620c87acd (patch) | |
| tree | 3aa4c62818ebcaca745fb06a341aab3f6c24177d | |
| parent | 8e9d90504ca95ae28a0ab0dc6f1e13c05b7b71fb (diff) | |
Plain writer: Support the four_space_rule extension. (#10813)
Allows using `-t plain+four_space_rule` to emulate the output of pandoc
before #7172. This is useful for users that use pandoc e.g. to
autoformat commit messages.
| -rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 3 | ||||
| -rw-r--r-- | test/command/10812.md | 41 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index a25e2761a..e92685f14 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -794,6 +794,9 @@ bulletListItemToMarkdown opts bs = do Markdown | isEnabled Ext_four_space_rule opts -> "- " <> T.replicate (writerTabStop opts - 2) " " + PlainText + | isEnabled Ext_four_space_rule opts + -> "- " <> T.replicate (writerTabStop opts - 2) " " _ -> "- " -- remove trailing blank line if item ends with a tight list let contents' = if itemEndsWithTightList bs diff --git a/test/command/10812.md b/test/command/10812.md new file mode 100644 index 000000000..7609f9133 --- /dev/null +++ b/test/command/10812.md @@ -0,0 +1,41 @@ +Check that the `four_space_rule` extension works for plain writer. + +``` +% pandoc -f markdown -t plain+four_space_rule +This is the title + +Here we fix: + +- a +- b +- c +^D +This is the title + +Here we fix: + +- a +- b +- c +``` + +Check that the `four_space_rule` extension is off by default. + +``` +% pandoc -f markdown -t plain +This is the title + +Here we fix: + +- a +- b +- c +^D +This is the title + +Here we fix: + +- a +- b +- c +``` |
