aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App/CommandLineOptions.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2025-08-11 19:54:23 +0200
committerJohn MacFarlane <[email protected]>2025-09-02 17:50:47 +0200
commite0acb24528cbf409ae5723e537acb0c2ed4e2d91 (patch)
tree77bf1d4ac09a2ec049da651d32bd97a04656dd4d /src/Text/Pandoc/App/CommandLineOptions.hs
parent64757254ab6e1d005cf8f4ee6c491d97aed7b16f (diff)
Refactor highlighting options [API Change]
A new command line option `--syntax-highlighting` is provided; it takes the values `none`, `default`, `idiomatic`, a style name, or a path to a theme file. It replaces the `--no-highlighting`, `--highlighting-style`, and `--listings` options. The `writerListings` and `writerHighlightStyle` fields of the `WriterOptions` type are replaced with `writerHighlightStyle`. Closes: #10525
Diffstat (limited to 'src/Text/Pandoc/App/CommandLineOptions.hs')
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index b28013107..e9d5e0597 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -520,13 +520,18 @@ options =
, Option "" ["no-highlight"]
(NoArg
- (\opt -> return opt { optHighlightStyle = Nothing }))
+ (\opt -> do
+ deprecatedOption "--no-highlight"
+ "Use --syntax-highlighting=none instead."
+ return opt { optSyntaxHighlighting = NoHighlightingString }))
"" -- "Don't highlight source code"
, Option "" ["highlight-style"]
(ReqArg
- (\arg opt ->
- return opt{ optHighlightStyle = Just $
+ (\arg opt -> do
+ deprecatedOption "--highlight-style"
+ "Use --syntax-highlighting instead."
+ return opt{ optSyntaxHighlighting =
T.pack $ normalizePath arg })
"STYLE|FILE")
"" -- "Style for highlighted code"
@@ -539,6 +544,14 @@ options =
"FILE")
"" -- "Syntax definition (xml) file"
+ , Option "" ["syntax-highlighting"]
+ (ReqArg
+ (\arg opt -> return opt{ optSyntaxHighlighting =
+ T.pack $ normalizePath arg })
+ "none|default|idiomatic|<stylename>|<themepath>")
+ "" -- "syntax highlighting method for code"
+
+
, Option "" ["dpi"]
(ReqArg
(\arg opt ->
@@ -809,8 +822,14 @@ options =
, Option "" ["listings"]
(OptArg
(\arg opt -> do
- boolValue <- readBoolFromOptArg "--listings" arg
- return opt { optListings = boolValue })
+ deprecatedOption "--listings"
+ "Use --syntax-highlighting=idiomatic instead."
+ boolValue <- readBoolFromOptArg "--listings" arg
+ return $
+ if boolValue
+ then opt { optSyntaxHighlighting =
+ IdiomaticHighlightingString }
+ else opt)
"true|false")
"" -- "Use listings package for LaTeX code blocks"