From f63b76e1698b0d7eba6b43ef45faaeee2b01b9ca Mon Sep 17 00:00:00 2001 From: Aner Lucero <4rgento@gmail.com> Date: Sat, 14 Nov 2020 20:09:44 -0300 Subject: Markdown writer: default to using ATX headings. Previously we used Setext (underlined) headings by default. The default is now ATX (`##` style). * Add the `--markdown-headings=atx|setext` option. * Deprecate `--atx-headers`. * Add constructor 'ATXHeadingInLHS` constructor to `LogMessage` [API change]. * Support `markdown-headings` in defaults files. * Document new options in MANUAL. Closes #6662. --- src/Text/Pandoc/App/CommandLineOptions.hs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/App/CommandLineOptions.hs') diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index a82d8380e..661c6e06d 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -529,9 +529,26 @@ options = , Option "" ["atx-headers"] (NoArg - (\opt -> return opt { optSetextHeaders = False } )) + (\opt -> do + deprecatedOption "--atx-headers" + "use --markdown-headings=atx" + return opt { optSetextHeaders = False } )) "" -- "Use atx-style headers for markdown" + , Option "" ["markdown-headings"] + (ReqArg + (\arg opt -> do + headingFormat <- case arg of + "setext" -> pure True + "atx" -> pure False + _ -> E.throwIO $ PandocOptionError $ T.pack + ("Unknown markdown heading format: " ++ arg ++ + ". Expecting atx or setext") + pure opt { optSetextHeaders = headingFormat } + ) + "setext|atx") + "" + , Option "" ["listings"] (NoArg (\opt -> return opt { optListings = True })) -- cgit v1.2.3