9281 Commits
Author SHA1 Message Date
John MacFarlane c9a741b4bd Fix spacing issue. 2025-12-01 09:45:44 +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
Asliddinbek Azizovich 094061d946 Add reveal.js scroll view option to HTML writer (#11305)
* Add revealjs `scroll` view option to HTML writer
* Add `scrollSnap` option into default.revealjs

Closes #10052
2025-11-30 13:45:36 +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 176d9be0f3 Change message for missing HTML title warning.
Suggest setting the `pagetitle` variable instead of setting
`title` in metadata, which also has the effect of adding an h1
element.

Closes #11307.
2025-11-30 12:22:56 +01:00
John MacFarlane af9443a981 RST reader: correctly handle intraword emphasis.
Closes #11309.
2025-11-30 12:16:40 +01:00
John MacFarlane cc9be5d9cb Make Control.Monad import unqualified.
ghc 9.6+ needs the import of MonadPlus, but previous
versions give a warning.
2025-11-30 10:25:10 +01:00
John MacFarlane fc4b6200bb Avoid compiler warning with mplus import. 2025-11-29 17:46:44 +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
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
Anton Antich ec75b693e5 Support pptx (PowerPoint) as an input format.
New module `Text.Pandoc.Readers.Pptx`,
exporting `readPptx`. [API change]

Factored out some common OOXML functions from
Text.Pandoc.Readers.Docx.Util into a non-exported module
Text.Pandoc.Readers.OOXML.Shared.
2025-11-24 22:37:39 +01:00
John MacFarlane 28338112ee HTML writer: use 'defer' when including mathjax script.
As recommended in the MathJax docs.

Closes #11292.
2025-11-16 14:17:59 +01:00
James Barlow 7b29962d86 LaTeX writer: make L1-3 headings work inside blockquotes.
Add mbox before all headings (not just L4+) inside blockquotes.
Otherwise LaTeX raises an error.

Closes #11281.
2025-11-12 23:40:15 +01:00
Albert Krewinkel a5576317c9 Docx reader: check recursively for caption styles.
The docx reader uses caption styles to identify figures and captioned
tables. It now checks for known caption styles in the full styles
hierarchy of a paragraph instead of just checking the style directly.
This allows to recognize caption styles that are built on top of the
basic *caption* style, as is sometimes the case in sophisticated styles.
2025-11-12 23:12:01 +01:00
John MacFarlane 5c3144feb8 PDF: avoid converting SVG to PDF when non-TeX PDF engine is used.
This fixes a 3.8 regression, which caused documents with SVGs to
raise an error when converted to PDF using WeasyPrint.

Closes #11275.
2025-11-06 00:12:46 +01:00
John MacFarlane 940c22bc31 LaTeX writer: Remove split from list of math environments.
This fixes #11274.
2025-11-05 17:31:34 +01:00
John MacFarlane 573921cc19 LaTeX reader: revert \linebreak as LineBreak.
`\linebreak` is more of a hint, it shouldn't produce
a hard break.

See #11272.
2025-11-05 12:51:30 +01:00
reptee c660bd3419 Add BBCode writer (#11242)
`bbcode` is now supported as an output format, as well as variants
`bbcode_fluxbb` (FluxBB), `bbcode_phpbb` (phpBB), `bbcode_steam` (Hubzilla),
`bbcode_hubzilla` (Hubzilla), and `bbcode_xenforo` (xenForo).

[API change]
Adds a new module Text.Pandoc.Writers.BBCode, exporting a number of functions.
Also exports `writeBBCode`,  `writeBBCodeSteam`, `writeBBCodeFluxBB`,
`writeBBCodePhpBB`, `writeBBCodeHubzilla`, `writeBBCodeXenforo` from
Text.Pandoc.Writers.
2025-11-05 12:49:46 +01:00
John MacFarlane 814bdbdbef Better handling of \makeatletter in parsing raw LaTeX.
Closes #11270.
2025-11-04 14:30:05 +01:00
John MacFarlane 69479fa490 Revert "Improve parsing of raw LaTeX blocks..."
This reverts commit 22863a3e12.
2025-11-04 14:09:37 +01:00
John MacFarlane 22863a3e12 Improve parsing of raw LaTeX blocks...
containing macro definitions with `\makeatletter` and `\makeatother`.

Closes #9953, see also #11270.
2025-11-04 14:02:25 +01:00
John MacFarlane 0e4c9b0ea6 T.P.LaTeX.Parsing: change type on rawLaTeXParser.
The preparser doesn't need to return a value.
2025-11-04 13:12:27 +01:00
Emmanuel Ferdman b106dca069 LaTeX reader: fix spurious paragraph breaks in math environments (#11265)
Previously, a math environment with extra space before the
`\end` would get rendered with a blank line, which LaTeX
treats as a paragraph break.

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2025-11-04 09:42:27 +01:00
John MacFarlane 74f583847f LaTeX reader: fix bugs in raw LaTeX parsing.
Fix `rawTeXParser`.  Make macro expansion in raw LaTeX depend on
the setting of the `latex_macros` extension.  Previously macros
were always expanded, even in raw TeX in markdown. In addition,
there was previously a bug that caused content to be garbled
in certain cases.

Closes #11253.

Handle `ifstrequal` at a lower level, like the other `if` commands.
See #11253.
2025-11-03 23:16:48 +01:00
Tuong Nguyen Manh 594f109956 asciidoc writer: Add more table features (#11267)
This adds the following table features:

- row span and column span
- footer row
- individual horizontal cell alignment

[API change] T.P.Writers.Shared: Add functions `allRowsEmpty` and
`tableBodiesToRows` from the RST writer for reuse in other writers.

Also fix hlint warning about `unzip` from `NonEmpty`:
The exported polymorphic function will become
monomorphic in the future. Restrict the `NonEmpty`
import to use the Prelude `unzip` function.
2025-11-03 20:30:33 +01:00
John MacFarlane a7778c80f3 Markdown reader: fix performance issue in links with '.
Closes #10880.
2025-11-03 17:09:34 +01:00
John MacFarlane 1edd5cde72 LaTeX writer: improve handling of math environments in tex math.
Previously the special handling added for #9711 worked only
when the math element did not contain spaces before the
math environment.

Closes #11266.
2025-11-02 15:37:54 +01:00
John MacFarlane b69e9dbb81 Typst reader: handle document metadata and #title.
See jgm/typst-hs#80.

Note that previously, the typst reader never returned document
metadata.  Now it does, even if the typst document does not contain
a `#title` function that would result in actually printing the
title block.
2025-10-30 20:02:28 +01:00
John MacFarlane 2c6cd8327a PDF: fix regression with typst and smart quotes.
Before 3.8, the default behavior when producing a PDF `-t typst`
was to produce smart quotes according to typst's defaults.
(This could be defeated by specifying `-t typst-smart`.)

This behavior broke in 3.8 because of a change to Text.Pandoc.PDF.
This change caused `smart` to be disabled for all formats when
producing PDFs, when before it was only disable for TeX-based
formats (to avoid bad ligatures).

This commit restores the old behavior. Possibly the regression also
other affects other non-TeX formats, e.g. HTML.

Closes #11256.
2025-10-30 17:49:46 +01:00
John MacFarlane d353e1d11c LaTeX reader: Moved some entries from environments to blockCommands.
They are not environments!  `ifstrequal`, `iftoggle`, etc.

ifstrequal, iftoggle, etc. -- these are not environments,
and they are handled under inlineCommands.
2025-10-28 22:49:38 +01:00
John MacFarlane 5ba0dbe976 Djot reader: add Space elements.
Previously we just got big Str elements with spaces included.
But many pandoc writers assume that breakable spaces will be
Space elements.  So, we got odd results with e.g. jira output.

Closes #11250.
2025-10-27 22:25:18 +01:00
John MacFarlane 8a60743624 Citeproc: allow formatting in locator to be transmitted to citeproc.
We do this indirectly, by rendering the formatting using the
HTML tags that citeproc recognizes.  Fixes jgm/citeproc#68
and jgm/citeproc#163.

Note that formatting is only possible for locators given in
the explicit form, surrounded by curly braces.  It won't work
for implicit locators, since these expect number-like expressions.
2025-10-24 23:11:26 +02:00
Albert Krewinkel 13a5b1a4df Org reader: parse parameter lists on unknown blocks.
The reader tries to parse the rest of the opening line of a block, e.g.,
`#+begin_myblock …`, as a parameters list. It first assumes that the parameters
are in lisp-style (`:key value`), then alternatively tries to read python-style
key-value pairs (`key=value`) and falls back to reading the entire remaining
line as a single `parameter` attribute.

This method is also applied to dynamic blocks.

Closes: #11188
2025-10-18 17:35:23 +02:00
Albert Krewinkel 941b5662d7 Org reader: add support for dynamic blocks. 2025-10-18 17:34:38 +02:00
John MacFarlane d4dd5e9ab9 Docx writer: properly handle nested comment spans.
Patch credit: @mmourino.

Closes #8189. Closes #6959.
2025-10-15 23:33:04 +02:00
TuongNM 80ccc78a52 RST writer: Don't use simple tables with RowSpans (#11214) 2025-10-14 19:07:02 +02:00
John MacFarlane d81ee85952 RTF reader: improve hyperlink parsing.
Closes #11211.
2025-10-13 20:23:22 +02:00
John MacFarlane 3d6439ad15 Typst writer: Escape open paren after non-space.
This fixes an issue that occurs if an open paren comes
right after e.g. `#strong[test]`.

Closes #11210.
2025-10-13 12:11:29 +02:00
John MacFarlane 001abd1d96 HTML reader: allow blank space between open and close iframe. 2025-10-11 19:01:03 +02:00
John MacFarlane d8354618c4 LaTeX writer/template: small fix for unnumbered tables.
This improves on commit e13aa5c015,
which worked only for recent versions of longtable.

For older versions, we need to define a dummy counter `none`.

Closes #11201.  Thanks to @priiduonu for the solution.
2025-10-06 23:04:40 +02:00
John MacFarlane e87b86261f Typst writer: don't add semicolons as much.
Previously we added semicolons after inline commands not
followed by spaces, but mainly this was to deal with one issue:
the presence of a semicolon after an inline command, which
would be swallowed as a command separator (#9252).

This commits adopts an approach that should avoid so many
superfluous semicolons: it escapes semicolons that might come
right after a command.  See #11196.
2025-10-05 16:33:03 +02:00
John MacFarlane c66553c76b Small improvement to oneOfStrings.
Use accumulator.
2025-10-04 19:26:59 +02:00
TuongNM 7571187792 LaTeX writer: Fix strikeout in links (#11192)
As in #1294 \url and \href need to be protected
inside an mbox for soul commands.

Closes #9366.
2025-10-04 19:21:18 +02:00
John MacFarlane 46ff66d28b Parsing.General: Rewrite oneOfStrings' with less conversion to string. 2025-10-03 11:41:20 +02:00
John MacFarlane e201e3370a Markdown tables: implement table_attributes extension.
When `table_attributes` is enabled (as it is by default for
pandoc's Markdown), attributes can be attached to a table by
including them at the end of the caption. Previously the writer
would emit an identifier in this position, but the reader didn't
handle it. Now arbitrary attributes are allowed, and they work in
both the reader and writer.

Closes #10884.

[API change]: Text.Pandoc.Extensions: Add `Ext_table_attributes`
constructor for `Extension`.
2025-10-02 13:37:53 +02:00
John MacFarlane e8bdaab34e T.P.XML: Add fetchpriority to list of HTML attributes.
Closes #11176.
2025-09-29 12:10:27 +02:00
TuongNM ca0fc7dc55 RST writer: Add col spans for simple tables (#11173)
Closes #10127.
2025-09-29 11:53:24 +02:00
TuongNM b62f2505b3 LaTeX writer: Fix strikeouts in beamer title (#11169)
beamer uses pdfstring for the pdfinfo which can't handle soul strikeouts.
Therefore, the title, subtitle and author contents need to be put inside
texorpdfstring to deal with both the pdfinfo as well as the formatting.

Fixes #11168.
2025-09-28 15:52:33 +02:00
John MacFarlane 3ffd47af68 Typst writer: Fix syntax highlighting.
See #11171.  Previously the native typst highlighting was
always used, regardless of the setting of `--syntax-highlighting`.
With this change, `--syntax-highlighting=none` and
`--syntax-highlighting=<style name>` (with skylighting) will work.

Completes #10525.
2025-09-28 15:36:21 +02:00