9082 Commits
Author SHA1 Message Date
John MacFarlane 01257ef6eb T.P.Writers.Shared: New version of gridTable.
This handles row and colspans. Partially addresses #6344.

It also ensures that cells won't wrap text in places where it
wouldn't normally wrap, even if this means making the cells wider
than requested by the colspec. (Closes #9001.  Closes 7641.)

Parameters are different, so this is a breaking [API change].

Markdown, RST, and Muse writers have been adjusted to
use the new `gridTable`.
2025-05-14 14:31:39 -07:00
Albert Krewinkel fb24d42ab7 T.P.Class.Sandbox: add function that can take a FileTree 2025-05-14 09:17:24 -07:00
John MacFarlane 605c1d4cde Markdown writer: omit initial newlines in gfm math blocks.
When the input is of the form
```
$$
x=y
$$
```
we would previously get:
````
``` math

x=y
```
````
which is ugly.
2025-05-13 10:18:40 -07:00
John MacFarlane f239a45b3e Use latest texmath and dev typst. 2025-05-12 13:50:32 -07:00
John MacFarlane 1239eaa4be Add new option --variable-json.
This allows non-string values (booleans, lists, maps)
to be given to template variables on the command line.

Closes #10341.
Supersedes #10342.
2025-05-11 18:10:11 -07:00
John MacFarlane bfcff3eb99 Org reader: change handling of inline TeX.
Previously inline TeX was handled in a way that was different
from org's own export, and that could lead to information loss.
This was particularly noticeable for inline math environments
such as `equation`.  Previously, an `equation` environment
starting at the beginning of a line would create a raw block,
splitting up the paragraph containing it (see #10836).
On the other hand, an `equation` environment not at the beginning
of a line would be turned into regular inline elements
representing the math. (This would cause the equation number to
go missing and in some cases degrade the math formatting.)

Now, we parse all of these as raw "latex" inlines, which will be
omitted when converting to formats other than LaTeX (and other
formats like pandoc's Markdown that allow raw LaTex).

Closes #10836.
2025-05-11 17:38:18 -07:00
John MacFarlane 1ce62c95f2 T.P.Readers.LaTeX.Math: export inlineEnvironmentNames.
Internal module, not a change to the public API.
2025-05-11 15:49:56 -07:00
R. N. West (Nat) f66481f96e Powerpoint writer: use reference-doc font for captions. (#10835)
Closes #9896.
2025-05-10 16:03:56 -07:00
John MacFarlane 8e327ea4e3 DocBook writer: use literallayout element for LineBlock.
See #10825.
2025-05-08 11:28:00 -07:00
John MacFarlane 60b4011902 DocBook reader: improve handling of literallayout.
This is now only made a CodeBlock when there is a `monospaced`
class.

Otherwise it is made a LineBlock.

Closes #10825.
2025-05-08 11:19:54 -07:00
Manolis Stamatogiannakis 7f9c776b97 Plain writer: Support the four_space_rule extension. (#10813)
Allows using `-t plain+four_space_rule` to emulate the output of pandoc
before #7172. This is useful for users that use pandoc e.g. to
autoformat commit messages.
2025-04-28 16:06:31 -07:00
John MacFarlane 8e9d90504c Typst writer: handle equation labels with spaces.
Closes #10805.
2025-04-26 17:32:45 -07:00
John MacFarlane fb5499d7af Typst writer: add equation label if math contains \label{..}.
Closes #10805.
2025-04-25 22:39:56 -07:00
John MacFarlane ec08f03782 OpenDocument writer: fix character styles in footnotes.
Character styles governing the position of the footnote
reference should not be imposed on the footnote text.
Closes #10791.
2025-04-18 10:47:47 -07:00
John MacFarlane 3cf722011a LaTeX reader: support more symbol commands.
Closes #10782.

`\textbaht`, `\textblank`, `\textbigcircle`, `\textbrokenbar`,
`\textbullet`, `\textcentoldstyle`, `\textcopyright`, `\textdagger`,
`\textdegree`, `\textdollar`, `\textdong`, `\textlira`, `\textmu`,
`\textmusicalnote`, `\textonehalf`, `\textonequarter`,
`\textparagraph`, `\textpertenthousand`, `\textpeso`,
`\textquotesingle`, `\textregistered`, `\textsection`,
`\textsterling`, `\textthreequarters`, `\textthreesuperior`,
`\texttwosuperior`, `\textyen`.
2025-04-14 10:45:00 -07:00
John MacFarlane 47610fe3de LaTeX reader: disable ligatures inside \texttt.
Closes #10781.
2025-04-14 10:23:26 -07:00
John MacFarlane c2482b9107 LaTeX writer: make alignment work within multirow in tables.
Closes #10772.
2025-04-09 22:38:43 -07:00
John MacFarlane c1cb32b3ab Docx writer: don't renumber rels. (#10770)
This fixes a regression introduced by af57648.

We used to renumber the Relationships so they didn't conflict with
the set of fixed Relationships we imposed.

We are now preserving the ids from the reference doc's
document.xml.refs, so we shouldn't renumber them or references
introduced by the user (e.g. in a template) will fail.

Closes #10769.
2025-04-08 15:00:16 -07:00
John MacFarlane 109d13d143 Recognize en as a langid in biblatex bibliographies.
Closes #10764.
2025-04-07 08:53:18 -07:00
John MacFarlane af57648e58 Docx writer: preserve Relationships for images from reference docx.
This should allow one to include an image in a reference.docx and
reference it in an openxml template.

Closes #10759.
2025-04-05 13:48:46 -07:00
John MacFarlane f8f7c29fb8 Allow compilation with random 1.2.*. 2025-04-05 12:31:40 -07:00
John MacFarlane 0d2114ee4e Markdown writer: improve use of implicit figures when possible.
Closes #10758.

When the alt differs from the caption, but only as regards
formatting, we still use an implicit figure.
2025-04-05 11:32:29 -07:00
John MacFarlane 2155b5f9bc Markdown writer: render a figure with Para caption as implicit figure.
Also, when falling back to a Div with class `figure` for a figure
that can't be represented any other way, include a Div with class
`caption` containing the caption.

Closes #10755.
2025-04-04 10:16:23 -07:00
John MacFarlane 82668ff9aa Typst writer: support mark class on spans.
Closes #10747.
2025-04-01 15:35:22 -07:00
John MacFarlane 69feb5ea9a Ms writer: ensure no line breaks in '.pdfhref O'. 2025-03-31 20:42:42 -07:00
John MacFarlane 2a53e25fac JATS writer: fix escaping for writing-review-editing role.
Closes #10744.
2025-03-31 14:11:34 -07:00
John MacFarlane e6974dfecb Require random >= 1.3 and use splitGen.
`split` has been deprecated.
2025-03-31 09:00:42 -07:00
John MacFarlane 3a3fc66726 Use pdf-engine variable instead of extensions...
...to determine what to do about `.pdfhref` macros in `ms`
output.

When no PDF engine is specified, we don't use the `.pdfhref`
macros at all. This gives better results for links in formats
other than PDF, since the link text would simply disappear if
it exists only in a `.pdfhref` macro.

When a PDF engine is specified,  escape the argument of
`.pdfhref O` in a way that is appropriate.

Remove `groff` extension.

Text.Pandoc.Extensions: remove `Ext_groff` constructor.

See #10738.  This revises the earlier commit
3adcb4bd80.
2025-03-29 22:42:22 -07:00
John MacFarlane 8016196562 Text.Pandoc.App: set pdf-engine variable.
If `--pdf-engine` is specified or if a PDF is being produced,
we set the `pdf-engine` variable. This allows writers and
templates to behave differently depending on the PDF engine.
2025-03-29 22:37:14 -07:00
John MacFarlane 3adcb4bd80 Allow groff to be used as --pdf-engine with ms.
When `groff` is used as a PDF engine, the `groff` extension
to `ms` is automatically enabled.

Limitations:

- `groff` currently produces larger PDFs than `pdfroff`.
- With `groff`, a table of contents produced with
  `--table-of-contents/--toc` will always be placed at the end of
  the document.
- Certain characters (e.g. Greek characters) may be dropped in
  the PDF outline.

Closes #10738.
2025-03-29 19:31:19 -07:00
John MacFarlane 5de83a4cc5 Add groff extension affecting ms writer.
When this extension is enabled, the `ms` writer won't
escape `.pdfhref O` macros in the way that is required
when `pdfroff` is used (octal-encoded UTF-16).

The extension is not enabled by default.

Text.Pandoc.Extensions: add `Ext_groff` constructor [API change].
2025-03-29 19:30:04 -07:00
John MacFarlane 3a0743e815 Org reader: don't include newlines in inine code/verbatim.
Convert newlines to spaces as we do in other formats.
Closes #10730.
2025-03-29 18:36:18 -07:00
Kolen Cheung b526c504ea fix(revealjs)!: upgrade reveal.js to v5 (#10740)
because v4 on unpkg.com is no longer available.
2025-03-29 09:53:55 -07:00
Christian Christiansen 25253bdea4 Add AVIF to Org Reader image extensions (#10736)
AVIF is an image extension. This commit enables the Org reader to recognise
AVIF files as images to be displayed, and not simply links.
2025-03-29 09:22:20 -07:00
Christian Christiansen 6226166647 T.P.Mime: fix typo in avif mime type (#10735)
`impage` -> `image`.
2025-03-28 20:11:49 -07:00
John MacFarlane 46399c0abd Ms writer: improve PDF TOC labels.
We now use the plain writer to render these, so that Greek characters
etc. will show up properly.

Note: the ms output this produces works well with pdfroff but not
with `groff -Tpdf`.
2025-03-25 10:24:02 -06:00
John MacFarlane 15052fd2fd Docx writer: ensure that figures and tables with custom styles...
...are not dropped.  Closes #10705.
2025-03-23 16:14:54 -07:00
John MacFarlane 752f198187 T.P.Writers.Roff: use the most compatible form.
The form `\[e aa]` works for groff but not for all roff's (not for
macOS man for instance).  So instead we'll emit `e` followed by
an escape for a unicode combining accent.

See #10716.
2025-03-23 11:14:37 -07:00
John MacFarlane 3bbca20240 Use the most compatible form for roff escapes.
This affects T.P.RoffChar, T.P.Writers.Roff,
and the Man and Ms writers.

That is, `\(xy` instead of `\[xy]`. This was the original AT&T troff
form and is the most widely supported.  The bracketed form causes
problem for some tools, e.g. `makewhatis` on macOS.

Closes #10716.
2025-03-23 10:29:17 -07:00
John MacFarlane 4ab4c62de3 Commonmark Reader: handle GFM math irregularity with braces.
In GFM, you need to use `\\{` rather than `\{` for a literal brace.
Closes #10631.
2025-03-22 10:30:16 -07:00
John MacFarlane 59fb9c40de MediaWiki reader/writer: allow definition on same line as term.
Closes #10708.
2025-03-21 21:54:47 -07:00
John MacFarlane 6b467b55a0 HTML writer: remove trailing slash from default revealjs url.
This avoids a double slash in the URL's path component, which
sometimes causes problems with CDNs. See #8749.
2025-03-21 11:09:58 -07:00
silby 0f71b9e8c4 Skip at most one argument to LaTeX tabular newline (#10707)
In LaTeX's tabular environment, the tabular newline takes an optional
argument that we skip. But it only takes a single optional argument, and
any further square-bracketed text that follows shouldn't be skipped.

Fixes #7512, and also adds a test for the original problem raised in
that issue which was already fixed at some point.
2025-03-19 16:33:19 -07:00
John MacFarlane bfa81a52a5 T.P.Readers.Docx.Util: use xml-lights's onlyElems...
...instead of defining it again.
2025-03-19 09:28:11 -07:00
John MacFarlane 5882f2dae2 Mime: handle apng, avif, jxl.
See #10704.
2025-03-19 08:55:58 -07:00
John MacFarlane 68bb4ae580 Handle percent encoding in pBase64URI.
This improves efficiency. See #10704.
2025-03-18 23:25:39 -07:00
John MacFarlane 93437525a7 Add mime type and extension for avif.
See #10704.
2025-03-18 22:54:25 -07:00
John MacFarlane b5e9ae3595 Fix parsing of base64 data URIs...
...to allow (a) URI escapes, (b) whitespace (which will be ignored).

Partially addresses #10704.
2025-03-18 09:10:59 -07:00
John MacFarlane 3acd8859bd T.P.Writers.Shared: rename surroundInlines -> delimited. 2025-03-17 11:24:38 -07:00
John MacFarlane f717d1bccc Markdown writer: avoid spaces after/before open/close delimiters.
E.g. instead of rendering `x<em> space </em>y` as `x* space *y`
we render it as `x *space* y`.

Closes #10696.
2025-03-17 09:56:49 -07:00