2823 Commits

Author SHA1 Message Date
John MacFarlane 643712ca70 LaTeX writer: avoid \_ in bibliography variable.
Since underscores are common in filenames, and pandoc will
render strings to variables using default LaTeX escaping, we
special-case `bibliography`, under the assumption that this variable
will be used in the context of the `\bibliography{..}` command,
which accepts unescaped underscores.

Closes #11152.
2025-09-19 10:16:25 +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 bbd7b60432 Use Tasty.Golden for Docx reader tests.
This way we can update them with `--accept`.
2025-09-17 12:06:13 +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
reptee a0cfb3fd31 Vimdoc writer (#11132)
Support for vimdoc, documentation format used by vim in its help pages.
Relies heavily on definition lists and precise text alignment to generate tags.
2025-09-15 12:45:28 +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
John MacFarlane 9c36d884d5 RST reader: parse :alt: on figure.
Also give a better default if `alt` is not specified, using
the stringified caption rather than the filename.

Partially addresses #11140.

Add failing test case for Markdown writer issue in #11140.
2025-09-15 10:50:04 +02:00
TuongNM e2f088f4e5 LaTeX writer: Protect VERB in caption (#11139)
Also apply hlint suggestions for fewer imports and
moving brackets to avoid $.
2025-09-15 10:28:57 +02:00
TuongNM 5eb25ab448 Markdown reader: Fix simple table alignment (#11136)
Take wide characters into account when determining the alignment.
2025-09-12 11:44:34 +02:00
Raymond Berger c93acab035 Add support for reading typst pagebreak (#11126)
The pagebreak is parsed as a HorizontalRule inside a wrapper Div with class `page-break`.

Closes #11101.
2025-09-10 09:56:16 +02:00
John MacFarlane 71a0c5c61e Markdown writer: use approximate pipe tables when it's the only option.
If we have a table with row/colspans that can rendered as an
approximate pipe table (without row/colspans), and no other table
format is enabled that could render the table, we fall back to
an "approximate" pipe table, with no row/colspans.

Closes #11128.
2025-09-10 09:49:06 +02:00
Tuong Nguyen Manh 47e1cc46c6 RST Reader: Add col spans for simple tables
[API change] Text.Pandoc.Parsing: New functions `tableWithSpans`,
`tableWithSpans'`, `toTableComponentsWithSpans` and
`toTableComponentsWithSpans'` take a list of lists of
(Blocks, RowSpan, ColSpan) to parse a Table with different RowSpan and
ColSpan values accordingly.
New helper functions `singleRowSpans` and `singleColumnSpans` help set
all RowSpans or ColSpans to be 1 in case the table format only allows
setting one or the other.
2025-09-09 10:27:18 +02:00
Albert Krewinkel 36bbdc667a T.P.Writers.Shared: add new function removeLinks.
The function converts links to spans. It is used, for example, to avoid
nested links.

The HTML writer used to put the description of nested links into small
caps, but uses a simple *span* now.
2025-09-09 10:26:05 +02:00
Tuong Nguyen Manh 6ba552232a pptx writer: Handle single column
Add an additional guard for a single column to be able to process it.
2025-09-08 09:22:56 +02:00
John MacFarlane 536d548335 Docx reader: better handling of AlternateContent.
This revises the solution to #9214 in commit 2e8ecb3 in order to
handle a standard Word way of inserting emojis.

Closes #11113.
2025-09-06 10:48:22 +02:00
John MacFarlane 0dc31a470f Fix test case that changed because of addition of nocase span. 2025-09-03 18:06:27 +02:00
John MacFarlane 037a6e81e2 T.P.Citeproc.BibTeX: Protect case in periodical titles.
Thus, for example, `{npj} Quantum Information` should translate as
`[npj]{.nocase} Quantum Information`.

Closes #11048.
2025-09-03 12:56:58 +02:00
Albert Krewinkel e0acb24528 Refactor highlighting options [API Change]
A new command line option `--syntax-highlighting` is provided; it takes
the values `none`, `default`, `idiomatic`, a style name, or a path to a
theme file. It replaces the `--no-highlighting`, `--highlighting-style`,
and `--listings` options.

The `writerListings` and `writerHighlightStyle` fields of the
`WriterOptions` type are replaced with `writerHighlightStyle`.

Closes: #10525
2025-09-02 17:50:47 +02:00
TuongNM 3e2c029a77 RST Reader: Support multiple header rows (#11057)
[API change] Text.Pandoc.Parsing: `tableWith` and `tableWith'` now
return a list of lists of Blocks, rather than a list of Blocks, for the
header rows, allowing for multiple header rows.

Closes #10338.
2025-09-02 13:12:34 +02:00
John MacFarlane f3c7a931b4 Update default.csl from new chicago-author-date.csl. 2025-09-02 12:42:16 +02:00
John MacFarlane 65c698a5bb Use latest dev citeproc. 2025-09-02 11:26:10 +02:00
Christopher T. Kenny 6070ad29cd Add features to typst base template (take 2).
New template variables supported: `thanks`, `abstract-title`, `linestretch`, `mathfont`, 
`codefont`, `linkcolor`, `filecolor`, `citecolor`.

Closes #9956, #11076.

(This is a new version of f000fa168b which
was reverted.)
2025-09-02 09:25:39 +02:00
John MacFarlane 4d545b69fe Change latex-pos to latex-placement. 2025-09-02 08:39:47 +02:00
Sean Soon 5424d3eca0 LaTeX writer: control figure placement with attribute (#11094)
If a `latex-pos` attribute is present on a figure, it will be used as the
optional positioning hint in LaTeX (e.g. `ht`).

With implicit figures, `latex-pos` will be added to the figure (and
removed from the image)  if it is present on the image.

Closes #10369.
2025-09-01 20:41:14 +02:00
John MacFarlane f865b3bc4b Typst reader: properly resolve image paths in included files.
Closes #11090.
2025-08-30 00:04:23 +02:00
Albert Krewinkel 01721c0960 Org reader: improve sub- and superscript parsing.
Sub- and superscript must be preceded by a string in Org mode. Some text
preceded by space or at the start of a paragraph was previously parsed
incorrectly as sub- or superscript.
2025-08-27 13:03:46 +02:00
John MacFarlane 6cff8dfc8a HTML reader: don't drop the initial newline in a pre element.
Closes #11064.
2025-08-26 18:57:14 +02:00
Tuong Nguyen Manh 01f97ed55d Typst Writer: Check XID_Continue in identifiers
Add unicode-data dependency for isXIDContinue for this to match the
rust implementation.
Also apply hlint suggestions for redundant $, literal pattern and
moving brackets to avoid $.
2025-08-26 18:25:08 +02:00
Sean Soon 1bee23683d Support header and footer in MAN reader 2025-08-26 18:22:16 +02:00
Reuben Thomas 5e92187c88 common.latex: add RTL support for LuaTeX engine 2025-08-24 09:59:48 +02:00
John MacFarlane 4c69f288d9 Revert "Add features to typst base template."
This reverts commit f000fa168b.
2025-08-24 09:47:44 +02:00
John MacFarlane 1ac4030c1a Rename command test for 10047 -> 11047.
Commit 2c857d3 closed #11047 but was mislabeled as closing #10047.
2025-08-17 17:53:32 +02:00
John MacFarlane 5e50e4e605 Citeproc: don't move footnotes around em-dashes.
Closes #11046.
2025-08-17 17:45:36 +02:00
John MacFarlane 2c857d379b Typst writer: add escapes to prevent inadvertent lists...
due to automatic wrapping.

Also simplify existing code that was meant to do this.

Closes #10047.
2025-08-17 17:45:36 +02:00
Albert Krewinkel de31a9f130 Org reader: accept quoted values as argument values.
Fixes: #8869
2025-08-14 19:35:37 +02:00
John MacFarlane a6a5be132a Typst writer: add parens around typst-native year-only citations.
Closes #11044.
2025-08-12 22:43:27 -07:00
John MacFarlane 0bbbdbcdb6 LaTeX reader/writer: change handling of math environments.
Certain environments in LaTeX will trigger math mode and can't
occur within math mode: e.g., `align` or `equation`.  Previously
we "downshifted" these, parsing an `align` environment as a
Math element with `aligned`, and an `equation` environment as a
regular display math element.  With this shift, we put these in
Math inlines but retain the original environments.

This works because:

1) texmath handles these environments just fine,
2) and so does MathJax;
3) when writing LaTeX we detect these environments in Math elements
   and emit them verbatim instead of putting them in `$..$` or
   `$$..$$`.

Closes #9711. Closes #9296.
2025-08-11 17:40:41 -07:00
John MacFarlane 6b2f66507a Use latest dev texmath. 2025-08-11 16:05:42 -07:00
Albert Krewinkel a5312c0828 LaTeX reader: parse \minisec as unlisted level 6 headings.
Closes: #10635
2025-08-10 18:36:52 -07:00
Tuong Nguyen Manh 816ca8480d ODT Reader: Add table-header-rows 2025-08-10 08:20:49 +02:00
Albert Krewinkel 7639e800c5 Org template: add #+options lines if necessary
The default template now adds `#+options` lines if non-default settings
are used for the `smart_quotes` and `special_strings` extensions.
2025-08-06 12:54:12 -07:00
Albert Krewinkel 90afbea1db Org writer: disable smart quotes by default 2025-08-06 12:54:12 -07:00
Albert Krewinkel b24bba7a20 Add smart_quotes and special_strings extensions for Org
Org mode makes a distinction between smart parsing of quotes, and smart
parsing of special strings like `...`. The finer grained control over
these features is necessary to truthfully reproduce Emacs Org mode
behavior. Special strings are enabled by default, while smart quotes are
disabled.

The behavior of `special_string` is brought closer to the reference
implementation in that `\-` is now treated as a soft hyphen.
2025-08-06 12:54:12 -07:00
n.west 96fe83ecf1 reference.docx: don't left-align table header row
See #11019. Previously, centering tables in `reference.docx` would leave
the header row left-aligned. Why the OOXML 'standard' would allow table
elements to be aligned differently from the rest of the table in the
first place is anyone's guess.
2025-08-04 15:07:58 -07:00
Joseph Reagle c1a4ae1abb Update 11013.md (#11020)
Original test had a poor/misleading title.
2025-08-04 13:05:16 -07:00
Evan Silberman b75c537d87 Fix named entity lookup in POD reader
Translating entities by name ultimately relies on
Commonmark.Entity.lookupEntity, which de facto requires the entity name
to be followed by a semicolon. Paste a semicolon onto the end of the
entity name read from POD to look it up.

Fixes #11015
2025-08-03 22:03:12 -07:00
John MacFarlane bc3a8a663d Typst reader: handle inline-level show rules on block content.
Typst allows things like `smallcaps` to be applied to block-level
content like headings.  This produces a type mismatch in pandoc,
so before processing the output of typst-hs, we transform it,
pulling the block-level elements outside of the inline-level
elements.

Closes #11017.
2025-08-03 15:20:11 -07:00