aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App
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-09-02T.P.Highlighting: export `defaultStyle` [API Change]Albert Krewinkel
This allows to be more explicit about using a default style, and providing a single point of truth for its value. The variable is an alias for `pygments`.
2025-08-28fix: recognize binary signatures and fail earlyRepetitive
Fail early when receiving binary input with recognized signature: - zip[-based]: including OpenDocument and Microsoft formats - PDF - CFBF-based: old Microsoft formats including .doc and .xls - DjVu
2025-08-27Add TODO comment.John MacFarlane
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-29Text.Pandoc.App: set `pdf-engine` variable.John MacFarlane
If `--pdf-engine` is specified or if a PDF is being produced, we set the `pdf-engine` variable. This allows writers and templates to behave differently depending on the PDF engine.
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.
2025-03-05Disable citations extension in writers if `--citeproc` is used.John MacFarlane
Otherwise we get undesirable results, as the format's native citation mechanism is used instead of (or in addition to) the citeproc-generated citations. Closes #10662.
2024-12-19Change `--template` to allow use of extensionless templates.John MacFarlane
The intent is to allow bash process substitution: e.g., `--template <(echo "foo")`. Previously pandoc *always* added an extension based on the output format, which caused problems with the absolute filenames used by bash process substitution (e.g. `/dev/fd/11`). Now, if the template has no extension, pandoc will first try to find it without the extension, and then add the extension if it can't be found. So, in general, extensionless templates can now be used. But this has been implemented in a way that should not cause problems for existing uses, unless you are using a template `NAME.FORMAT` but happen to have an extensionless file `NAME` in the template search path. Closes #5270.
2024-12-14Use catMaybes instead of building with maybe and (:) one element at a timeJoseph C. Sible
2024-12-07Stylistic tweak.John MacFarlane
2024-12-07T.P.App.OutputSettings: add `sandbox'` function.John MacFarlane
This computes the sandboxed files from Opt and avoids some code repetition in T.P.App and T.P.App.OutputSettings.
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-16Make env interpolation work for `to` and `from` fields...John MacFarlane
...in defaults files. These can contain paths of custom readers and writers. See #8024.
2024-09-08Initialize some missing fields in pandoc-server.John MacFarlane
writerEpubTitlePage, writerChunkTemplate, writerListTables.
2024-09-08T.P.Opp: Change default for optNumberOffset to `[]`.John MacFarlane
This behaves the same as `[0,0,0,0,0]`.
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-05-10Collect transforms in new module T.P.Transforms. [API change]Albert Krewinkel
Bundles all document transformations, i.e., functions that run predefined filters on Pandoc documents.
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.
2024-04-20Change to `--file-scope` behavior.John MacFarlane
Previously a Div with an identifier derived from the filename would be added around the contents of each file. This caused problems for "chunking" files into chapters, e.g. in EPUB. We no longer add the surrounding Div. This cooperates better with chunking. Note, however, that if you have relied on the old behavior to link to the beginning of the contents of a file using its filename as identifier, that will no longer work. Closes #8741.
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 errors for illegal output formats.John MacFarlane
Previously if you did `pandoc -s -t bbb`, it would give you an error about the missing bbb template instead of saying that it's not a supported output format.
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-07-05Make modern AsciiDoc the target for `asciidoc`.John MacFarlane
The AsciiDoc community now regards the dialect parsed by `asciidoctor` as the official AsciiDoc syntax, so it should be the target of our `asciidoc` format. Closes #8936. The `asciidoc` output format now behaves like `asciidoctor` used to. `asciidoctor` is a deprecated synonynm. For the old `asciidoc` behavior (targeting the Python script), use `asciidoc_legacy`. The templates have been consolidated. Instead of separate `default.asciidoctor` and `default.asciidoc` templates, there is just `default.asciidoc`. Text.Pandoc.Writers.AsciiDoc API changes: - `writeAsciiDoc` now behaves like `writeAsciiDoctor` used to. - `writeAsciiDoctor` is now a deprecated synonym for `writeAsciiDoc`. - New exported function `writeAsciiDocLegacy` behaves like `writeAsciDoc` used to.
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-06-27Use toTextM instead of toText when possible.John MacFarlane
(That is, whenever we have the filename and are in a PandocMonad instance.) This will lead to more informative error messages for UTF8 encoding, indicating the file path and byte offset where the error occurs. Closes #8884.
2023-06-27Text.Pandoc.Class: add `toTextM`.John MacFarlane
This is like `Text.Pandoc.UTF8.toText`, except: - it takes a file path as first argument, in addition to bytestring contents - it raises an informative error with source position if the contents are not UTF8-encoded [API change] This replaces `utf8ToText` in `Text.Pandoc.App.Input`. See #8884.
2023-06-19Allow `epub-title-page` to be used in defaults files.John MacFarlane
This wasn't implemented before due to an oversight. Closes #8908.
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-03-20T.P.Format: add new function `formatFromFilePaths` [API Change] (#8710)Albert Krewinkel
* T.P.Format: export `formatFromFilePaths` [API change] * Lua: add function `pandoc.format.from_path` * Update lua-filters.md * The old T.P.App.FormatHeuristics module has been removed. This is an alternative to #8693.
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.