From 7f9c776b978458a467a83f662cf8d55620c87acd Mon Sep 17 00:00:00 2001 From: Manolis Stamatogiannakis Date: Tue, 29 Apr 2025 01:06:31 +0200 Subject: 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. --- src/Text/Pandoc/Writers/Markdown.hs | 3 +++ test/command/10812.md | 41 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 test/command/10812.md 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 +``` -- cgit v1.2.3