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>
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.
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.
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.
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.
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>
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.
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.
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.
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.
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.
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.
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.
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.
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.
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>
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>
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>
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>
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.
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.
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>
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.