1248 Commits

Author SHA1 Message Date
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 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
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
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 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
John MacFarlane af9443a981 RST reader: correctly handle intraword emphasis.
Closes #11309.
2025-11-30 12:16:40 +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 97f7a93460 Add command test for #9953. 2025-11-04 14:08:57 +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 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
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
John MacFarlane eb9bfb6b96 Fix #6959 test so it works on Windows. 2025-10-16 11:17:35 +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 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
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 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
TuongNM ca0fc7dc55 RST writer: Add col spans for simple tables (#11173)
Closes #10127.
2025-09-29 11:53:24 +02:00
John MacFarlane 95326e21e6 Add shorthands variable for LaTeX output.
If true, pandoc will allow language-specific shorthands
when loading babel.

Closes #11160.
2025-09-24 22:25:07 +02:00
John MacFarlane 9024df9348 RST writer: ensure blank line before directives.
Closes #11162.
2025-09-24 21:32:31 +02:00
TuongNM bdab9915ad OpenDocument writer: Add missing table elements (#11157)
Add missing header rows after the first one,
footer rows as well as TableBody header rows.

Also apply hlint suggestions to use Down and fuse mapM/map.

Closes #10002.
2025-09-20 21:05:29 +02:00
John MacFarlane 70393b4235 RST reader: fix regression in simple table parsing.
Closes #11150.
2025-09-18 11:52:22 +02:00
John MacFarlane d820620ccd Docx reader: properly calculate table column widths.
Previously we assumed that every table took up the full text
width. Now we read the text width from the document's
sectPr.

Closes #9837.
Closes #11147.
2025-09-17 14:24:33 +02:00
John MacFarlane e13aa5c015 LaTeX writer: ensure that unlabelled tables don't increment counter.
Closes #11141.
2025-09-16 18:01:07 +02:00
John MacFarlane cf760c7f66 Markdown reader: Improve superscript/subscript/inline note parsing.
We do not allow inline notes to be followed by `(` or `[`.
Otherwise, we parse inline notes before superscripts.
This fixes #8652.

Also, the sub/superscript parsers have been adjusted so that they
really exclude unescaped spaces (as they did not before, when the
spaces occurred in nested inlines). See #5878 for comment.
2025-09-16 12:46:25 +02:00
John MacFarlane 1f3163a638 LaTeX reader: ignore \pandocbounded.
Third issue in #11140.
2025-09-15 10:50:04 +02:00
John MacFarlane f7059959ed Markdown writer: improve handling of implicit figures.
Allow implicit figures when alt text differs from caption
(in this case, we use an image attribute to add the alt).

Closes #11140.
2025-09-15 10:50:04 +02:00