Commit Graph
9350 Commits
Author SHA1 Message Date
John MacFarlane 5db6c52fbd Textile reader: handle block content in cells.
Closes #11455.
2026-02-12 21:21:14 +00:00
John MacFarlane 35638d965f Typst reader: Handle bibliography command.
If this is present, a bibliography section is added to the
document and the bibliography paths are added to `bibliography`
in the metadata. This sets things up for using `--citeproc`.

Closes #11460.
2026-02-12 16:34:33 +00:00
John MacFarlane a0448c7168 Typst writer: improve handling of data: URIs in images.
Instead of using an SVG with a link containing the data URI
(the solution of #10460), we can now simply produce a `bytes`
object with the requisite bytes. Typst figures out the format
automatically.
2026-02-09 17:03:05 +01:00
John MacFarlane ebd425d867 Typst writer: don't add a carriage return after \ for hard break.
They are not necessary.  Note that they can still be included if
you use `--wrap=preserve` and add a newline in your source
document.

This fixes issues with line breaks in headings.
Closes #11446.
2026-02-07 10:57:50 +01:00
John MacFarlane 8cdb31d6e0 T.P.Error: define displayException for PandocError.
This is a behavior change, not an API change, since there
was already a definition that defaulted to using Show.
The change here is that we use renderError for a more human-readable
version.
2026-01-31 10:59:13 +01:00
Jacob Larkin 89d78b3ab7 Enhance variable expansion in defaults files
- Factor out expansion logic into expandVars and expandEnv for better
  maintainability and reuse.
- Ensure the '.' variable correctly resolves to the directory of the
  current defaults file, enabling relative paths in inherited defaults.
- Expand environment variables in 'data-dir' and use the expanded
  path when resolving child defaults.
- Allow environment variable expansion within 'defaults' file paths.

These changes make the defaults system more flexible for hierarchical
configurations without breaking backward compatibility.

Closes #8024.
2026-01-31 10:54:59 +01:00
John MacFarlane 818c840e10 Allow defaults files to be either JSON or YAML. 2026-01-31 10:32:51 +01:00
John MacFarlane 828382ba65 Revise change to --extract-media.
An earlier change added the feature that if the specified file
ends in .tar, a tar archive is created instead of a directory.
This has now been changed to create a zip archive if the filename
ends in .zip.
2026-01-30 19:43:32 +01:00
John MacFarlane c8aa6c2a38 Markdown reader: support alerts extension for pandoc markdown.
It is not enabled by default.

Closes #9716.
2026-01-27 12:44:43 +01:00
John MacFarlane 8191d06aff DocBook reader: omit empty title when not required.
Closes #11422.

This affects example and sidebar elements.
2026-01-27 10:20:31 +01:00
John MacFarlaneandClaude Opus 4.5 f0991cfcbb Reveal.js writer: add idiomatic highlight.js support.
Closes #11420.

When using `--syntax-highlighting=idiomatic` with reveal.js output,
pandoc now generates HTML compatible with reveal.js's built-in
highlight.js plugin:

- Code blocks use `<pre><code class="language-X">` format
- The template loads highlight.js CSS, JS, and RevealHighlight plugin
- Theme defaults to "monokai", configurable via `highlightjs-theme`
   variable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 13:53:38 +00:00
John MacFarlane 6212407eea MediaWiki writer: improve blank space around div elements.
This is merely cosmetic.

Closes #11417.
2026-01-24 14:53:08 +00:00
John MacFarlaneandClaude Opus 4.5 154b36a05e MediaWiki writer: use Doc Text instead of Text for document construction.
This refactors the writer to use Text.DocLayout combinators (vcat, hcat,
literal, blankline, cr, chomp) for building output, following the pattern
used by other text format writers (RST, Markdown, Man). This enables
better control over line spacing and paragraph separation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 14:32:24 +00:00
John MacFarlaneandClaude Opus 4.5 52120f92a6 Docx writer: replace generic XML traversal with direct path navigation.
Instead of using Data.Generics `everywhere` to traverse the entire XML
tree when setting language attributes, navigate directly to the known
path w:docDefaults/w:rPr/w:lang. This is more efficient and removes the
dependency on Data.Generics (mkT, everywhere).

The new `modifyAtPath` helper function takes a list of predicates that
match element names at each level of the path and modifies only the
target element.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 23:34:03 +01:00
John MacFarlaneandClaude Opus 4.5 94efb21520 Docx writer: refactor writeDocx into helper functions.
Extract 15 helper functions from the monolithic writeDocx function
to improve code clarity and maintainability. The function is now
organized into clear phases with well-typed helpers for each task:

- loadArchives: Load reference and distribution archives
- extractPageLayout: Extract page dimensions from template
- extractRelationships: Parse and augment document relationships
- mkLangTransformer: Build language transformer for XML elements
- mkFootnotesEntry, mkCommentsEntry: Create XML entries
- mkContentTypesEntry, mkDocumentRelsEntry: Create manifest entries
- mkStylesEntry, mkNumberingEntry: Create document formatting entries
- mkCorePropsEntry, mkCustomPropsEntry: Create property entries
- mkPackageRelsEntry: Create package-level relationships
- collectReferenceEntries: Collect auxiliary entries from reference

Also adds module-level constants stdAttributes and settingsElementNames
for clarity. No functional changes; all existing tests pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 23:34:03 +01:00
John MacFarlane b45f6cf86a HTML slide formats: make . . . pause work in nested blocks.
Closes #8715. Closes #7201. Closes #7582.
2026-01-23 16:31:11 +01:00
John MacFarlane c8ad2752c4 Markdown writer: properly handle tables with footers.
Closes #11416.
2026-01-23 10:51:29 +01:00
Gordon WoodhullandClaude Opus 4.5 e07a3f3454 LaTeX writer: Add PDF standard support via DocumentMetadata (#11407)
Add `pdfstandard` metadata variable for specifying PDF standards
(PDF/A, PDF/X, PDF/UA) in LaTeX output. Uses LaTeX's \DocumentMetadata
command which requires LuaLaTeX.

- PDF version requirements are automatically inferred, but can be explicitly
  overridden.
- Automatic tagging for standards that require it (ua-1, ua-2, a-2a, a-3a).
- Warning for unsupported standards
- Documentation in MANUAL.txt (Variables for LaTeX, Accessible PDFs)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 20:00:57 +01:00
John MacFarlane 395fb2db43 Docx reader: look inside v:rect as well as v:shape.
This partially addresses #11412, but it would be nice to
add proper handling of the caption.
2026-01-22 19:23:36 +01:00
John MacFarlane d599154394 Markdown reader: allow superscripted spans.
These were being parsed as inline notes. Now we disallow an
inline note followed by attributes, as this is almost certainly
meant to be a span.

Closes #11409.
2026-01-21 17:04:49 +01:00
John MacFarlane 1eab54eb92 Allow --extract-media to extract to a tar archive...
instead of a directory.  This happens when the path given has a
.tar extension.
2026-01-18 19:24:02 +01:00
John MacFarlane 2ce4db75da AsciiDoc writer: export spaces inside delimited constructs like emph. 2026-01-16 00:14:23 +01:00
John MacFarlane cb6f5a3b37 DocBook/JATS reader: don't export surrounding space from inline elements.
Previously we would export leading and trailing space inside
elements like emphasis or ulink so they appeared outside the
resulting pandoc Inline (Emph or Link). This is not really
motivated; DocBook and XML in general treats leading and trailing
whitespace in this context as significant.

These spaces may casue problems for some output formats, e.g.
asciidoc, but these issues should be addressed in the
corresponding writers, as they are in the Markdown writer,
using Text.Pandoc.Writers.Shared.delimited.

Closes #11398.
2026-01-15 10:55:58 +01:00
Chris Callison-BurchandChris Callison-Burch d14dee0dc2 PPTX writer: support notes field in metadata for title slide (#11396)
This adds support for a `notes` field in the YAML metadata block
that will be used as speaker notes for the title slide in PowerPoint
output.

Previously, there was no way to add speaker notes to the title slide
since it is generated from metadata rather than from content blocks.
The `::: notes` syntax only works for content slides.

Example usage:

    ---
    title: My Presentation
    notes: |
      Welcome everyone to this presentation.
      Remember to introduce yourself.
    ---

Closes #5844 (for PPTX output).

Co-authored-by: Chris Callison-Burch <ccb+github@upenn.edu>
2026-01-14 11:14:30 +01:00
John MacFarlane 8123be654d Markdown writer: Allow display math to start/end with space.
This reverts to earlier < 3.7 behavior.
Closes #11384.
2026-01-08 11:41:35 +01:00
John MacFarlane 6c28eadd6c LaTeX reader: handle more quote macros.
(From fontspec and ngerman babel.)

Closes #6120.
2026-01-08 11:23:03 +01:00
John MacFarlane 8a75c077b0 Logging: add pretty field to ToJSON instance for LogMessage.
This just reproduces the output of `logMessage`, for convenience
for those who are using the JSON output outside of Haskell.
2026-01-07 11:33:37 +01:00
John MacFarlane b206e941ca EPUB writer: don't use footnote backlinks for EPUBv3.
Here we use aside elements, which are popups, and the backlinks
are not needed; in some readers they cause a redundant number to
appear, since the reader adds a note number.

Standard practice seems to be not to use these.
2026-01-07 11:21:50 +01:00
John MacFarlane b026624ed7 Docx reader: handle tables without tblGrid.
Closes #11380.
2026-01-07 11:21:50 +01:00
You Jiangbin c0b66602c2 Fix docx writer: skip directory entries when building media overrides (#11379)
Pandoc's docx writer was previously adding an `<Override>`
for `/word/media/` in `[Content_Types].xml` when the reference doc
contains media, which violates OPC rules and causes Word
 to report corruption.
2026-01-07 11:21:06 +01:00
Yann Trividic 2a426718bc DocBook reader: support "role" attribute (#11255)
The `role` attribute is parsed and added to Pandoc AST elements,
using a wrapper Div if needed.
2026-01-03 12:36:19 -05:00
John MacFarlane 60369fd353 Remove redundant check for asciidoc in UnknownReader. 2026-01-03 11:22:40 -05:00
John MacFarlane 91f6d08bea AsciiDoc writer: use a span with role for SmallCaps.
Closes #11374.
2026-01-03 11:20:28 -05:00
Tuong Nguyen Manh 2327e302cb RTF reader: Improve hyperlink parsing more (#11370)
Both the field instruction and its result may be ungrouped.

Closes #10942.
2026-01-02 11:43:15 -05:00
John MacFarlane b7bd1210b0 MediaWiki: better handling of inline tags.
`<mark>`, `<var>`, `<samp>`, and `<kbd>` now produce Code or Span
elements with classes, which can be handled by multiple output
formats, instead of simply being parsed as raw HTML tags.

Closes #11299.
2025-12-30 12:11:46 -07:00
John MacFarlane 7cadf23197 MediaWiki reader: handle non-recognized tags as plain text.
Partially addresses #11299.
2025-12-29 23:49:51 -07:00
John MacFarlane e5ee5ed04f RTF reader: fix bug where list items were...
...incorporated into a following table.
Closes #11364.
2025-12-29 10:11:41 -07:00
Tuong Nguyen Manh 854b7332d9 ODT reader: Add table row and column spans (#11366)
Parse the number-rows-spanned and number-columns-spanned attributes to
create Cells for the Table.
2025-12-28 17:13:06 -07:00
John MacFarlane 6956176c19 AsciiDoc writer: use doubled delims in more contexts.
Also escape the `#` character.

Closes #11362.

An alternative solution, raised in #11362, would be to
rely less on escaping and simply always use doubled delimiters.
However, there would still be a need for escaping, since one
might use a literal `##` (for example)>
2025-12-27 23:10:22 -07:00
Tuong Nguyen Manh d52e40d179 RTF reader: Ensure new paragraph on \pard (#11361)
New paragraphs may start with \pard alone without an explicit paragraph
break with \par preceding it.
2025-12-27 22:42:22 -07:00
John MacFarlane 455bea907d Factor out openURL into T.P.Class.IO.HTTP.
Unexported module.
2025-12-24 12:17:35 -07:00
John MacFarlane 5988155f09 openURL without http support: Use throwError rather than error. 2025-12-24 11:20:19 -07:00
John MacFarlane 83692bbc50 Add http cabal flag.
This allows pandoc to be compiled without support for making
HTTP requests, which is useful when WASM is the target.

Closes #10980.
2025-12-24 11:00:25 -07:00
John MacFarlane eef6cde22f Change PandocHttpError constructor type.
Now it takes a Text instead of an HttpException as the second
argument. [API change]

Motivation: if we expose HttpException in the public API, it
makes it difficult to provide a version of pandoc that can
be compiled to wasm, which currently can't handle the network
libraries.

See #10980.
2025-12-24 09:20:39 -07:00
Anton Melnikov af27e8a421 MediaWiki reader: add behavior switches support (#11354)
MediaWiki format supports [magic
words](https://www.mediawiki.org/wiki/Help:Magic_words). These are
basically built-in templates. This commit introduces support for behavior
switches, which is one of the three types of magic words. They add
a field to metadata without producing any text.

Signed-off-by: botantony <antonsm21@gmail.com>
2025-12-20 21:27:28 -08:00
John MacFarlane e57ab4734e PDF: add SOURCE_DATE_EPOCH to verbose env variable info 2025-12-15 22:30:22 +01:00
John MacFarlane bde04d14d2 Fix typo. 2025-12-15 20:53:35 +01:00
benniekiss db9be758bc Markdown reader: fix parsing of inline math ($...$) (#11348)
Do not allow blank lines before closing `$` delimiter.
This brings the parser in line with the documentation.

Closes #11311.
2025-12-14 16:46:31 +01:00
Tuong Nguyen Manh e8ed40ef01 DocBook reader: Fix adding wrong metadata (#11347)
Now keep track of the current element stack to only add metadata if
inside an appropriate parent element.

Closes #11300.
2025-12-13 22:28:59 +01:00
John MacFarlane e7e1f13bcb Fix some more imports involving foldl'. 2025-12-12 11:00:21 +01:00