Commit Graph

2734 Commits

Author SHA1 Message Date
John MacFarlane 3769d0cbf4 Typst template: fix regression introduced in 3.9.0.1.
This introduced a bug that will produce the error message
`the character `#` is not valid in code`.

Closes #11538.
2026-03-19 09:17:46 +01:00
John MacFarlane ef6b669e25 Markdown reader: Fix bug with lists_without_preceding_blankline.
This was not properly implemented, causing some unintended
results. Closes #11534.
2026-03-17 19:37:08 +01:00
John MacFarlane 4fbe52f4c1 Update typst tests for template change. 2026-03-17 11:00:39 +01:00
John MacFarlane bf45205b8a Update typst test for math changes. 2026-03-15 18:12:01 +01:00
John MacFarlane c8ee9dc545 Docx reader: preserve non-textbox content when unwrapping textboxes.
Previously, when a w:p paragraph contained runs with textboxes,
the entire paragraph was replaced by just the textbox content,
discarding all other runs (including image-bearing runs).
Now we walk the paragraph's children in order, grouping
non-textbox content into copies of the original w:p and splicing
unwrapped textbox content in place, preserving the original order.

We also treat text inside a textbox containing an image as a
figure caption.  (One often finds captioned images of this
kind in docx files.)

Closes #11510.
Closes #6893.
Closes #11412.
Closes #5394.
Closes #9633.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-14 20:12:34 +00:00
Raymond Berger f0d05eb438 Docx reader: Recognize media inside textboxes (#11515)
Closes #11053.
2026-03-12 22:26:17 +01:00
John MacFarlane 80c704a9ac Typst writer: properly escape . after bracketed argument.
(When it might be mistaken for field access.)

Closes #11511.
2026-03-09 14:10:53 +01:00
Albert Krewinkel 40b525352d JATS writer: improve representation of divs
The writer now checks if the element used to represent (non-special)
divs has any `<boxed-text>` specific attributes. If it does, the writer
keeps wrapping the div contents in a `<boxed-text>`, as it did before.
Otherwise, the writer falls back to the more appropriate `<p>` element
or simply unwraps the div if the wrapping element wouldn't have any
attributes. The new behavior gives better semantic results in most
cases, as `<boxed-text>` should be used for text that "is outside the
flow of the narrative text", which doesn't apply to most divs.

"Special" divs, like those used to mark sections, are not affected by
this change.
2026-03-06 13:59:04 +01:00
massifrg 15ddf4124c ICML writer support for image object styles (#11498)
This change allows users to style images in InDesign bysetting the
`object-style` attribute in a pandoc Image, which is mapped to the
AppliedObjectStyle attribute in the Rectangle element around
an Image element in the resulting ICML.
2026-03-03 22:31:55 +01:00
John MacFarlane a6ab08da9f MediaWiki writer: use appropriate syntax for external images.
Note that they will only be rendered as images if an
option `$wgAllowExternalImages` is enabled in the MediaWiki instance.

Closes #11494.
2026-03-03 15:38:51 +00:00
John MacFarlane fd8d755f8a Markdown writer: escape literal & that would trigger entity.
Closes #11490.
2026-02-27 11:51:35 +01:00
Christophe Dervieux 7bd9dbecdc Revealjs writer: default scrollProgress to 'auto'.
RevealJS defaults scrollProgress to 'auto', but the writer was
setting it to true.  Use lookupMeta to distinguish between
MetaBool True, MetaBool False, and unset (defaulting to 'auto').
The template uses a helper variable scrollProgressAuto since
pandoc templates cannot distinguish a MetaString "auto" from
MetaBool True in a single variable.
2026-02-25 11:45:30 +01:00
Christophe Dervieux bf96353c48 Revealjs template: fix type rendering of scroll-view options.
Remove quotes from scrollActivationWidth (should be a number,
not a string).  Use $if/$else$ guard for scrollSnap so that
`false` renders as a boolean literal rather than the string
'false'.  Add /nowrap to scrollSnap and scrollLayout.
2026-02-25 11:45:30 +01:00
John MacFarlane a56d98f9c4 HTML styles template: avoid duplicate code selector.
Consolidate two clauses. Closes #11484.
2026-02-23 17:36:50 +01:00
John MacFarlane e270beac1a Docx writer: fix section breaks with --top-level-division.
Previously, the fix for #10578 (removing leading section break to avoid
blank first page) was implemented inside blocksToOpenXML, which is called
recursively for Div contents. Since makeSectionsWithOffsets wraps each
section in a Div, this caused ALL section breaks to be stripped, not just
the first one (#11482).

This commit fixes the issue by tracking whether we've processed the first
section header using a new stFirstSectionHeader state flag. Section breaks
are now correctly added between chapters/parts while still avoiding a
blank first page.

Closes #11482.
See also #10578.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-23 10:46:18 +00:00
John MacFarlane be5bafcfc9 Markdown writer: Fix rendering of alerts.
We only properly handled the case where the alert started with
a paragraph, but it can start with a list or other block type.

Closes #11479.
2026-02-18 10:21:41 +01:00
Gordon Woodhull e427b7795e typst: use both place and block for title
otherwise the title will be confined to the left column
2026-02-16 23:36:50 +01:00
Jan Tojnar 84e39ff36f Odt reader: Support Preformatted Text from pandoc writer
pandoc generates a separate style class like P123 for each paragraph,
inheriting the desired style using `parent-style-name`.

Previously, we did not support that but it is pretty easy to add.
Though for simplicity this fix does not extend to finding the parent
style recursively when deeper hierarchies are involved.
2026-02-16 13:54:34 +01:00
Jan Tojnar b4f71f7ef0 Odt reader: Support Preformatted Text style
LibreOffice uses `Preformatted_20_Text` as the default style for
code listings etc. Let’s detect if a paragraph has the `style-name`
and convert it to `CodeBlock` if it is the case.

Unfortunately, pandoc itself generates a separate style class like P123
for each paragraph so we will not yet support code listings from documents
generated by pandoc itself.

Closes #4841.
2026-02-16 13:54:34 +01:00
Jan Tojnar edd6865f1c Odt writer: Rename inline source class to match LibreOffice
Rename the text style we use to represent `Code` inlines from
`Source_20_Text` to `Source_Text`.

This is the same name LibreOffice Writer uses so it will be recognized
by the Character Styles section of the Styles menu.

Closes #3390.
2026-02-16 13:54:34 +01:00
Jan Tojnar 4d7669666a Odt reader: Recognize Preformatted_20_Text style
This is used by LibreOffice, and we will switch to that as well.
2026-02-16 13:54:34 +01:00
Tuong Nguyen Manh 1e4fc7254b ODT Reader: Fix relative linked images (#11467)
Like with relative links ODT adds a `../` to relative linked images
which needs to be removed.

Fixes #11369.
2026-02-15 18:20:47 +01:00
John MacFarlane cc72b8054c Typst writer: include alt attributes on images.
This borrows a test case taken mostly from #11394 by @mcanouil
but the code is fresh.  The behavior is similar to what we
have with the HTML and LaTeX writers.

Obsoletes #11394.

Co-authored by @mcanouil and Claude Opus 4.6.
2026-02-14 16:19:41 +01:00
John MacFarlane 3c56088b4e LaTeX reader: support \footnotemark and \footnotetext (#11450).
These commands allow separating the footnote mark from its content,
useful in tables, minipages, and other contexts where \footnote
cannot be used directly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Closes #11450.
2026-02-14 14:22:15 +00:00
Jan Tojnar 3b9a47d02e readers/docx: Support w:gridBefore table row property (#11464)
Table rows in Docx files can use `w:gridBefore` property to specify
a number of extra empty table cells to be inserted at the beginning
of a row. Without this, table columns in tables using the element
will become misaligned.

https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.gridbefore?view=openxml-3.0.1

In the worst case, this can lead to cells at the end of some rows
to be dropped by the parser.

The test file was produced as follows based on
the “3GPP TS 24.282 V19.5.0 (2025-12)” document obtained from
<https://www.3gpp.org/ftp/Specs/archive/24_series/24.282/24282-j50.zip>
where I encountered the issue:

1. Extracted the `document.xml`.
2. Formatted it with `xmllint --format`.
3. Found the raw XML for “Table 15.2.13-2: Payload content type”.
4. Removed `w:rsid*` and `w14:*` attributes, and `w:pStyle` elements.
5. Replaced the context of `test/docx/raw-blocks.native`.
6. Used pandoc to generate the docx.
2026-02-14 14:28:03 +01:00
John MacFarlane 04848401d5 Typst writer: fix escaping of quotes.
All quotes should be escaped the same way with `smart`; previously
we were treating right and left single quote differently.

Closes #11463.
2026-02-13 11:01:37 +01:00
John MacFarlane 5db6c52fbd Textile reader: handle block content in cells.
Closes #11455.
2026-02-12 21:21:14 +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
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 MacFarlane 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 MacFarlane 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 MacFarlane 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 Woodhull 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-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