aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App/CommandLineOptions.hs
AgeCommit message (Collapse)Author
2025-12-12Fix imports to avoid warning about foldl'.John MacFarlane
`foldl'` is exported by Prelude by base 4.20+. So we need to do some qualified importing to avoid warnings about redundant imports.
2025-09-02Refactor highlighting options [API Change]Albert Krewinkel
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
2025-08-09T.P.Options: Add and export `defaultWebTeXURL` WebTeX URL [API change] (#11029)Sean Soon
This fixes the `webtex` option when used without parameter in a defaults file.
2025-07-25PDF: Improve error readability when pdf-engine is not supported.Albert Krewinkel
Each supported engine is now printed on a line of its own.
2025-07-25PDF: allow `pdflatex-dev` and `lualatex-dev` as PDF enginesAlbert Krewinkel
These are the development versions of the LaTeX binaries; installable, e.g., with `tlmgr install latex-base-dev`. Closes: #10991
2025-07-13Remove code duplication around version info.John MacFarlane
Text.Pandoc.App.CommandLineOptions and pandoc-cli/src/pandoc.hs had similar code for generating version information. To avoid duplication, we now export `versionInfo` from Text.Pandoc.App [API change]. (The function is reexported from the non-public module Text.Pandoc.App.CommandLineOptions.) This function has three parameters that can be filled in when it is called by pandoc-cli. This change will make it simpler to revise version information.
2025-07-13Revert "Export `copyrightMessage` from Text.Pandoc.App module."John MacFarlane
This reverts commit 2cf9b55421d7026dac8c45730b8538f13e4bbb78.
2025-07-13Export `copyrightMessage` from Text.Pandoc.App module.John MacFarlane
Export `copyrightMessage` from the unexported module Text.Pandoc.App.CommandLineOptions and reexport from Text.Pandoc.App [API change]. This avoids the need for a duplicated version in pandoc-cli, which can now depend on the library's exported version.
2025-07-13Use hardcoded string "pandoc" for program name in `--version`.John MacFarlane
Per GNU guidelines: https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html
2025-07-13Update `--version` copyright dates.John MacFarlane
Closes #10961.
2025-05-11Add new option `--variable-json`.John MacFarlane
This allows non-string values (booleans, lists, maps) to be given to template variables on the command line. Closes #10341. Supersedes #10342.
2025-03-29Allow `groff` to be used as `--pdf-engine` with `ms`.John MacFarlane
When `groff` is used as a PDF engine, the `groff` extension to `ms` is automatically enabled. Limitations: - `groff` currently produces larger PDFs than `pdfroff`. - With `groff`, a table of contents produced with `--table-of-contents/--toc` will always be placed at the end of the document. - Certain characters (e.g. Greek characters) may be dropped in the PDF outline. Closes #10738.
2024-09-22Add support for list of figures (lof) and list of tables (lot) (#10029)Akash Patel
Two new command-line options are added: `--lof[=true|false]`, `--list-of-figures[=true|false]` `--lot[=true|false]`, `--list-of-tables[=true|false]` Only docx, latex, and context are supported at this point. Setting the `lof` and `lot` variables will also work for the formats that are currently supported. [API changes] + Lua: `list_of_figures` and `list_of_tables` can now be used in writer options. + Text.Pandoc.Options: add `writerListOfFigures` and `writerListOfTables` fields to `WriterOptions`. + Text.Pandoc.App.Opt: add `optListOfFigures` and `optListOfTables` to `Opt`. Closes #8245. Co-authored-by: John MacFarlane <[email protected]>
2024-09-08Add options to change table/figure caption positions.John MacFarlane
+ Add command line options `--table-caption-position` and `--figure-caption-position`. These allow the user to specify whether to put captions above or below tables and figures, respectively. The following output formats are supported: HTML (and related such as EPUB), LaTeX (and Beamer), Docx, ODT/OpenDocument, Typst. + Text.Pandoc.Options: add `CaptionPosition` and new `WriterOptions` fields `writerFigureCaptionPosition` and `writerTableCaptionPosition` [API change]. + Text.Pandoc.Opt: add `Opt` fields `optFigureCaptionPosition` and `optTableCaptionPosition` [API change]. + Docx writer: make table/figure rendering sensitive to caption position settings. + OpenDocument writer: make table/figure rendering sensitive to caption position settings. + Typst writer/template: implement figure caption positions by triggering a show rule in the default template, which determines caption positions for figures and tables globally. + LaTeX writer: make table/figure rendering sensitive to caption position settings. Closes #5116. + HTML writer/template: make `<figcaption>` placement sensitive to caption position settings. For tables, `<caption>` must be the first element, and positioning is determined by CSS, for here we set a variable which the default template is sensitive to.
2024-09-02Change default `--pdf-engine` via HTML to WeasyPrint.John MacFarlane
wkhtmltopdf is deprecated. weasyprint is the easiest-to-install, maintained alternative. For better results, one might prefer pagedjs-cli. Closes #10142.
2024-07-27Allow --number-sections to take an optional true|false argument.John MacFarlane
This was omitted when we allowed this for other boolean flags.
2024-07-01Add option to link rather than embedding images in ODT.John MacFarlane
New cli option: `--link-images`. This causes images to be linked rather than embedded in ODT. New field in WriterOptions: `writerLinkImages` [API change]. New field in Opt: `optLinkImages` [API change]. Closes #9815.
2024-04-25Update copyright dates to 2024.John MacFarlane
2024-04-25CommandLineOptions: simplify output for OptVersion.John MacFarlane
Omit the information about versions of dependencies. We no longer emit version info at this level anyway; pandoc-cli intercepts `--version`. This code would only be called if someone used the pandoc library function `handleWithOptInfo` in their own program.
2023-07-19Refine command line option preprocessor and add tests for #8956.John MacFarlane
The substantive change here is the `-strue` will now work instead of being interpreted as `-s -true`. This is somewhat ad hoc, but I don't think we'll ever have an output format named `rue`, so it's probably okay.
2023-07-19Fix regression on short boolean arguments.John MacFarlane
In 3.1.5 boolean arguments were allowed an optional argument (true|false). This created a regression for uses of fused short arguments, e.g. `-somyfile.html`, which was equivalent to `-s -omyfile.html`, but now raised an error because pandoc attempted to parse `o` as a boolean `true` or `false`. This change adds a preprocessing step on the raw arguments before they are sent to the option parser. In this preprocessing step, `-somyfile.html` would be split into two arguments, `-s` and `-omyfile.html`. The splitting happens when a short boolean option is followed by another short option. Closes #8956.
2023-07-18Fix typo on error message for incorrect --preserve-tabs argument.John MacFarlane
Thanks @fsoedjede
2023-07-16Fix typo from last commit.John MacFarlane
2023-07-16Capitalize option errors.John MacFarlane
2023-07-16Make --epub-title-page's argument optional.John MacFarlane
It takes a boolean argument, and now that all of our boolean flags take such an argument, we can make this one optional for consistency.
2023-07-16Improve errors for incorrect command-line option values.John MacFarlane
Always give the name of the relevant argument. See #8879.
2023-06-28Allow all boolean flags to take an optional 'true' or 'false' valueSam S. Almahri
Default is true if no value is specified, so this is fully backwards-compatible. Closes #8788.
2023-03-26Support typst as a pdf-engine.John MacFarlane
2023-03-23T.P.App.CommandLineOptions: don't lowercase arg to `--from`/`--read`Albert Krewinkel
This prevented users to use custom writers with uppercase characters in their filenames. Format-normalization, including lower-casing of format identifiers, happens during format parsing.
2023-01-30Add new `--chunk-template` option (closes #8581).John MacFarlane
* Add `--chunk-template` CLI option, allowing more control over the chunk filenames in chunked HTML output. * Text.Pandoc.App: Add `optChunkTemplate` constructor to Opt [API change]. * Text.Pandoc.Options: add `writerChunkTemplate` contsructor to WriterOptions [API change]. * Text.Pandoc.Chunks: add Data, Typeable, Generic instances for PathTemplate.
2023-01-29Fix 3.0 regression with `--print-highlight-style` option.John MacFarlane
Closes #8586.
2023-01-25Ensure that automatically set variables ...John MacFarlane
`pandoc-version`, `outputfile`, `title-prefix`, `epub-cover-image`, `curdir`, `dzslides-core` can be overridden by `--variable` on the command line. Previously they would create lists in the template Context, which is not desirable.
2023-01-12Replace `--epub-chapter-level` with `--split-level`.John MacFarlane
Rationale: we need this splitting level now not just in EPUB but in chunked HTML. `--epub-chapter-level` will still function as a deprecated synonynm. `epub-chapter-level` will also continue to work in defaults files, ande `epub_chapter_level` will still work for Lua marshalling. [API changes] Text.Pandoc.App.Opt: remove `optEpubChapterLevel`, add `optSplitLevel`. Text.Pandoc.Options: remove `writerEpubChapterLevel`, add `writerSplitLevel`.
2023-01-10Update copyright years, it's 2023!Albert Krewinkel
2022-12-20T.P.Scripting: Refactor the scripting engine.John MacFarlane
The new type CustomComponents is exported from T.P.Scripting, and the ScriptEngine fields are changed. Instead of separate fields for custom readers and writers, we now have a single function that loads any number of "components" from a script: these may be custom readers, custom writers, templates for writers, or extension configs. (Note: it's possible to have a custom reader and a custom writer for a format together in the same file.) Pandoc now checks the folder `custom` in the user's data directory for a matching script if it can't find one in the local directory. Previously, the `readers` and `writers` data directories were search for custom readers and writers, respectively. Scripts in those directories must be moved to the `custom` folder. Custom readers used to implement a fallback behavior that allowed to consume just a string value as input to the `Reader` function. This has been removed, the first argument is now always a list of sources. Use `tostring` on that argument to get a string. Closes #8417. Signed-off-by: Albert Krewinkel <[email protected]>
2022-12-05Lua: support `-D` CLI option for custom writers [API change]Albert Krewinkel
A new error `PandocNoTemplateError` (code 87) is thrown if a template is required but cannot be found.
2022-12-04EPUB writer: make title page optional.John MacFarlane
New command line option: `--epub-title-page=true|false`. New `writerEpubTitlePage` field on `WriterOptions` [API change]. New `optEpubTitlePage` field on `Opts` [API change]. Closes #6097.
2022-11-02Text.Pandoc.App: Change `parseOptionsFromArgs` and `parseOptions`... (#8406)John MacFarlane
They now return `Either OptInfo Opt`. Add `OptInfo` type. Add `handleOptInfo` function. This performs the IO actions for things like `--version` that were previously done in `parseOptionsFromArgs`. An argument for a `ScriptingEngine` has been added, to facilitate printing custom templates and custom extensions for Lua filters. (However, at this stage nothing is yet done with it.) [API change]
2022-10-30hlint suggestions.John MacFarlane
2022-10-20Add custom extensions.John MacFarlane
T.P.Extensions [API change]: + Add CustomExtension constructor to Extension. + Remove Bounded, Enum instances for Extension. + Add `extensionsToList` function. + Revise `readExtension` so it can handle CustomExtension, and so that it returns a Text rather than Maybe Text. + Add `showExtension`. T.P.Format: + Revise error checking to handle CustomExtension.
2022-10-19Text.Pandoc.Shared: remove `ordNub` [API change].John MacFarlane
This is just `nubOrd` from Data.Containers.ListUtils.
2022-10-19Move `defaultUserDataDir` from T.P.Shared to T.P.Data [API change].John MacFarlane
2022-10-19Text.Pandoc.Shared: remove `elemText`, `notElemText`. [API change]John MacFarlane
2022-10-15Minor code cleanups.John MacFarlane
2022-10-13Rollback parameterize options on scripting engine.John MacFarlane
Rolls back 0ab014ed1e5890e338792fab98aecc45cd889f99. We don't need this because we aren't needing to print the Lua version in options any more; we're handling `--version` now at the pandoc-cli level.
2022-10-03Separate out T.P.Data, T.P.Translations from T.P.Class. (#8348)John MacFarlane
This makes T.P.Class more self-contained, and suitable for extraction into a separate package if desired. [API changes] - T.P.Data is now an exported module, providing `readDataFile`, `readDefaultDataFile` (both formerly provided by T.P.Class), and also `getDataFileNames` (formerly unexported in T.P.App.CommandLineOptions). - T.P.Translations is now an exported module (along with T.P.Translations.Types), providing `readTranslations`, `getTranslations`, `setTranslations`, `translateTerm`, `lookupTerm`, `readTranslations`, `Term(..)`, and `Translations`. - T.P.Class: `readDataFile`, `readDefaultDataFile`, `setTranslations`, and `translateTerm` are no longer exported. `checkUserDataDir` is now exported. - Text.Pandoc now exports Text.Pandoc.Data and `setTranslations` and `translateTerm`.
2022-09-30Move `--version` handling to pandoc-cli.John MacFarlane
Print flag settings (lua, server) and versions of all relevant packages. Add suffix for nightly builds. Move `nightly` flag from pandoc to pandoc-cli. Closes #8339.
2022-09-30App: stop including the HsLua version in version info outputAlbert Krewinkel
2022-09-30[API Change] App: parameterize `options` over the scripting engineAlbert Krewinkel
2022-09-30[API Change] Rename `pandocVersion` to `pandocVersionText`...Albert Krewinkel
and add a new `pandocVersion` value with type `Version`. This is consistent with the type used for `pandocTypesVersion` and allows to use the value where a Version type is required.