2705 Commits
Author SHA1 Message Date
Mickaël Canouil 65f0b491c9 Typst template: improve accessibility of definition lists (#11436).
The show rule we used for definition lists created problems when
typst was run with `--pdf-standard=ua-1`.  This patch fixes things,
and also prevents definition list items from breaking across pages.
2026-02-03 21:58:28 +01:00
John MacFarlane 8263ea2bf7 Add tests for #8024. 2026-01-31 10:54:59 +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 cab682ba58 HTML writer: Include all classes on highlighted code elements.
Previously, only the language class was included, and the
others were dropped.

Closes #11423.
2026-01-27 12:00:31 +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 MacFarlane 49eb145292 Add tests for #7201, #7582. Rescind claim to have fixed #8715. 2026-01-23 23:28:02 +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 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 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
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 12ad483674 Typst template: disable hyphenation for title, subtitle.
Closes #11375.
2026-01-03 11:32:22 -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 d21c17c096 Update asciidoc writer tests for last commit. 2025-12-28 07:21:35 -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
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 6f401799b7 Updaet to latest dev texmath, typst. 2025-12-14 22:42:47 +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
Albert Krewinkel 47ada83bcb JATS writer: fix XML output for nested figures
Subfigures are now wrapped inside a `<fig-group>` element. Furthermore,
figure content that isn't allowed as children of `<fig>` elements, such
as raw text, gets wrapped in `<p>` elements to ensure schema-conform
XML production.

Fixes: #11342
2025-12-11 19:57:54 +01:00
John MacFarlane 1f76d3f154 Markdown writer: use setext for headers containing line breaks...
...for commonmark.  Closes #11341.
2025-12-11 11:30:38 +01:00
John MacFarlane a6fae6b780 Org: don't include 'example' class when parsing org example blocks.
These are just unmarked code blocks.

Closes #11339.
2025-12-10 23:55:08 +01:00
John MacFarlane b6339f9baa Typst writer: escape hyphens when needed.
Closes #11334.
2025-12-09 19:11:47 +01:00
John MacFarlane 7767011767 Implement reset-citation-positions class on headings.
When the `reset-citation-positions` class is added to
a top-level heading, `--citeproc` will reset position
information at that point in the document. This is needed
in order to ensure that the first citation in a chapter
to a work that has been cited in a previous chapter will
not be in abbreviated form.

Requires a dependency on a development version of citeproc.
2025-12-07 17:07:05 +01:00
John MacFarlane 7ced712014 HTML5 template: conditionally include lang attribute.
Previously we included it unconditionally, even if this
meant giving it an empty value.  This seems at best redundant,
since the empty value is the default. At worst, it adds clutter
and according to some sources may prevent the use of browser defaults.

I believe that the justification for including these attributes
even with empty values is not a good one; see commit 07d51d9
for the original change.  On my reading, the HTML spec does not
require the presence of the attribute on the html element; it
only says that if the attribute is present, it must have an
empty string or valid BCP 47 language tag as its value.

See also #11324.
2025-12-06 11:51:09 +01:00
John MacFarlane a3ab4b8545 HTML reader: parse inline style elements as RawInline.
This is a cleaner fix to #10643 than the reverted commit 7fe8c92.

Styles are not stripped, but with this change they will not
interfere with inline parsing.

Closes #11246.
2025-12-05 11:14:11 +01:00
John MacFarlane 41b14dc891 RST reader: fix definition lists where term ends with -.
This reverts some old code giving special treatment to lines
ending in hyphens; I don't understand why it was there, because
rst2html does not seem to do this.

Closes #11323.
2025-12-05 10:46:24 +01:00
John MacFarlane b9b6ba0805 Texinfo writer: improve handling of certain code blocks.
MediaWiki, for example, will parse a code block containing
formatting as a sequence of Code elements separated by
LineBreaks. For this we now use a texinfo example block.

Closes #11312.
2025-12-02 12:04:36 +01:00
Ezwal fc07b06851 Docx reader: Handle REF link instruction (#11296)
This PR aims to handle a common run field instruction (fieldInstr)
from docx format :  REF, specifically those with the "link" switch \h.

In word software, you can create REF field instruction with the
Cross-reference button. You can create cross-reference to
many things such as Equation, Table, Title...
2025-11-30 13:49:58 +01:00
Tuong Nguyen Manh 58e741a0d6 ANSI writer: Apply row spans in tables (#11294)
The ANSI writer is now able to keep track of row spans and apply them in rows.

[API change] T.P.Writers.Shared:
Add functions `insertCurrentSpansAtColumn`, `takePreviousSpansAtColumn`
and `decrementTrailingRowSpans` for applying and keeping track of
RowSpans over multiple rows.

Fixes: #10149
2025-11-30 13:20:30 +01:00
Tuong Nguyen Manh 6592dfb082 pptx writer: Handle reference doc without slides (#11310)
An empty `sldIdLst` is now added if the reference doc is missing one so that
`modifySldIdLst` can replace it. To ensure PowerPoint doesn't say that the file
will need fixing, the `sldIdLst` has to be placed after the `sldMasterIdLst`.
I also added a test to ensure that if there are notes, they will be placed between
the `sldMasterIdLst` and `sldIdLst`. Otherwise PowerPoint wouldn't show the
slide of a note when viewing Notes Pages.

Closes #7536.
2025-11-30 13:17:34 +01:00
John MacFarlane af9443a981 RST reader: correctly handle intraword emphasis.
Closes #11309.
2025-11-30 12:16:40 +01:00
John MacFarlane 37b7bd3b38 Use latest dev asciidoc. 2025-11-30 11:08:32 +01:00
John MacFarlane 8651ec3c28 Add asciidoc as an input format.
New exported module Text.Pandoc.Readers.AsciiDoc,
exporting readAsciiDoc [API change].

The bulk of parsing is handled by the asciidoc library.

Closes #1456.
2025-11-29 17:04:42 +01:00
John MacFarlane 525113c31e Fix warning in Docx reader test. 2025-11-24 23:39:59 +01:00
Anton Antich 59b8b3ed4b Add xlsx (Microsoft Excel) as an input format.
Each worksheet turns into a section containing a table.

The common file `nativeDiff` has been extract from
the Docx and Pptx text files and put in Tests.Helpers.
2025-11-24 23:10:33 +01:00