Commit Graph
19075 Commits
Author SHA1 Message Date
John MacFarlane f6edf03303 Shared: Improve makeSections.
Previously it would sometimes create doubled section divs.
By leaving the inner heading's id on the heading itself, and
then consolidating the inner and outer section divs, we can
avoid this undesirable result.

Closes #11745.
2026-07-07 20:58:33 +02:00
John MacFarlane db7efddf74 Texinfo writer: fix spacing bug around HorizontalRule.
Closes #11749.
2026-07-07 16:58:44 +02:00
John MacFarlane 9a94445b6a epub.css: get rid of obsolete #TOC rules.
We don't generate anything with the TOC id in epubs.
A table of contents is in nav#toc and we have rules for
that.

Closes #11747.
2026-07-05 17:50:28 +02:00
Can H. Tartanoglu 57639391fc ODT writer: image anchoring, percent dimensions, text width resolution (#11746)
Inline images now emit `text:anchor-type=as-char` on their `draw:frame`,
anchoring the frame as a character so it flows with the surrounding text.
Without this, consumers default to paragraph anchoring and float the frame
beside (or after) the following paragraph.

When both width and height are given and the width is a percentage,
the width is now resolved against the reference document text area width,
mirroring how the docx writer derives its print width from the reference docx
section properties. The height follows the aspect ratio.
2026-07-04 18:52:14 +02:00
John MacFarlane 4f5226df4f epub.css: Put clause for all headings before individual h1, h2, ...
This is more logical, since the individual clauses are meant to
override. Closes #11742.
2026-07-01 17:11:57 +02:00
John MacFarlane d8ea25c10e HTML styles: remove hard-coded font-size for print CSS.
Print CSS now uses the inherited font-size.
2026-07-01 13:54:24 +02:00
John MacFarlane ceb0917599 Ensure that IO error messages go to stderr.
Closes #11710.
2026-07-01 13:09:47 +02:00
John MacFarlane 8547196b44 Markdown reader: ordered sublists must start with 1
(or equivalent, e.g. 'i').  This brings the markdown
parser in line with commonmark, and avoids a lot of
unintended list starts.  Closes #11735.

Note that ordered lists that are not sublists may
still start with numbers other than 1.
2026-07-01 11:17:21 +02:00
John MacFarlane 76bd78f653 CommandLineOptions: use optCSL and optBibliography...
from Opt.  Previously we set optMetadata directly, but that
had some unintended effects, especially in interacting with
defaults files. With this change, a `--csl` on the command
line can override one set in a prior defaults file.

Closes #11741.
2026-06-30 15:28:05 +02:00
John MacFarlane 612e143fbe DokuWiki reader: skip non-cell content after table row.
Closes #11739.
2026-06-29 19:28:54 +02:00
John MacFarlane 18ff8a8073 Fix stack.yaml 2026-06-29 18:16:15 +02:00
John MacFarlane bc217a1d56 Use dev djoths. 2026-06-29 14:28:48 +02:00
John MacFarlane 1c22498269 LaTeX writer: fix footnotes in def list headings.
Closes #8240.
2026-06-29 11:40:30 +02:00
dependabot[bot] e80a34f721 Bump actions/cache from 5 to 6 (#11737)
Bumps [actions/cache](https://github.com/actions/cache) from 5 to 6.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-29 11:01:36 +02:00
Albert Krewinkel c568a0e665 Typst template: allow multiword keywords (#11730)
Typst expects single words as keywords, so keywords consisting of
multiple words must be quoted (and should not be wrapped).
2026-06-23 19:06:58 +02:00
John MacFarlane c7b6552552 MANUAL.txt: clarify expectations for EPUB metadata.
See #11723.
2026-06-23 16:51:46 +02:00
John MacFarlane 22f11b8871 MANUAL.txt: improve instructions for specifying EPUB identifier.
Closes #11723.
2026-06-23 12:27:34 +02:00
John MacFarlane 197ea8e8bd RST reader: treat undefined substitution references as plain text.
This mirrors rst2html behavior. Closes #11727.
2026-06-23 12:06:27 +02:00
Enrico Spinielli 090cb52f0a Fix typo in lua-filters.md (#11724)
Removed duplicated 'using'
2026-06-23 01:46:54 +02:00
dependabot[bot] b7ce1047c6 Bump actions/checkout from 6 to 7 (#11725)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-23 01:46:07 +02:00
John MacFarlane 58929eb70c Markdown writer: in YAML metadata, put double quotes around...
...strings that are numbers beginning with 0 or ending with 0 and
having a decimal point.  Otherwise they will read as YAML numbers
and potentially be modified (e.g. 3.10 -> 3.1).

It would be better to fix this on the reader side, but since
we use a standard YAML parser it's hard to see how.

Closes #11715.
2026-06-21 15:15:42 +02:00
John MacFarlane 4f73087589 MANUAL: clarify comment about table types.
See #11719.
2026-06-21 11:57:59 +02:00
Scott Talbert d706da2379 Fix typo in MANUAL.txt (shoud -> should) (#11720)
As reported in Debian by lintian on the manpage.
2026-06-20 23:03:18 +02:00
John MacFarlane da82107116 Change adding of .yaml extension in --defaults option.
Previously it was always added if the specified filename
lacked an extension. Now it is only added if there is
no file with the original name.  So, these are tried in
order: `FILE`, `FILE.yaml`, `DATADIR/defaults/FILE`,
`DATADIR/defaults/FILE.yaml`.

This facilitates using `--defaults` with bash/zsh `<(..)` or
`=(..)`.

Closes #11717.
2026-06-18 23:27:17 +03:00
John MacFarlane 1a1a5efcb2 Fix typo in manual. 2026-06-18 23:05:54 +03:00
John MacFarlaneandClaude 850c7b9613 App: enable auto_identifiers when a table of contents is requested.
Table-of-contents entries link to heading identifiers, so when
`--toc/--table-of-contents` is given, force the `auto_identifiers`
extension on for the input format even when it is off by default
(as it now is for typst).  This makes typst-to-markdown `--toc`
produce working links.

Closes #11041.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-13 23:40:17 +02:00
John MacFarlaneandClaude ec4fb91049 Typst reader: support auto_identifiers extension.
Headings without an explicit label can now be assigned automatic
identifiers based on the heading text, making them linkable in a
generated table of contents.  The extension is available for the
typst reader but is off by default; enable it with
`-f typst+auto_identifiers`.  The related `gfm_auto_identifiers` and
`ascii_identifiers` extensions are also made available.

Closes #11041.

Text.Pandoc.Readers.Typst.Parsing: PState gains sOptions,
sIdentifiers, and sLogMessages fields, and now has
HasReaderOptions, HasIdentifierList, and HasLogMessages
instances, allowing reuse of the shared registerHeader. (Not an
API change.)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-13 23:38:51 +02:00
Robertas 853ae7fecc HTML reader: fix unused variable warning in CI (#11704) 2026-06-13 10:00:18 +02:00
Robertas f751000aa4 Docx writer: fixes for test failures in #11697 (#11703) 2026-06-12 21:07:59 +02:00
John MacFarlane 8a52ac1493 Markdown writer: improve identification of code language class...
...by looking it up in the syntax map. (Previously we just used
the first, excepting `sourceCode`.)

Closes #11701 (together with previous commit).
2026-06-12 21:01:25 +02:00
John MacFarlane 6049ab9c09 HTML reader: strip language- from all classes, not just first.
Also combine classes from both code and pre class if they are
nested.

See #11701. Improves on the fix to #7221.
2026-06-12 21:00:59 +02:00
Robertas 06af643730 Docx writer: use namespace URI instead of prefix in extractPageLayout (#11697)
When a reference document uses a non-standard namespace prefix for the
WordprocessingML namespace (e.g. `ns0` instead of `w`), `sectPr` elements
copied from the reference would retain the non-`w` prefix, producing
malformed XML in the output document.  Similarly,
`extractPageLayout` only matched elements with prefix `w`, missing
`sectPr` elements with other prefixes.  This is fixed by matching on the
namespace URI rather than the prefix, and normalizing the prefix to `w`
on all elements and attributes copied from reference-doc `sectPr`.

Some new tests have been added, and the test suite has been streamlined
using helper functions.
2026-06-12 18:13:10 +02:00
John MacFarlane 912bfa5e2e Use starmath for math in ODT.
This improves appearance and editability of math in ODT.

Depends on dev version of texmath.

The main code changes are due to @jdpipe (#11470).
2026-06-09 13:06:17 +02:00
John MacFarlaneandClaude 1b4a5356b4 Docx reader: key list numbering off abstractNumId.
Word represents "restart numbering" on a style-based list by pointing
only the first item of the restarted list at a new `numId` that shares the
original list's abstract numbering definition but carries a
`w:startOverride`; the remaining items keep using the original `numId`.

Pandoc keyed list continuation and grouping on the `numId`, so the
restarted items continued the stale count from the earlier list (and
were split into a separate ordered list with the wrong start).

Key continuation and grouping off the `abstractNumId` instead (the real
running counter in Word), and treat `startOverride` as a restart that
resets the count.

Closes #8367.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-09 11:59:10 +02:00
John MacFarlane c60b7f3f08 Fix typo in pandoc.cabal test files. 2026-06-09 11:19:48 +02:00
John MacFarlane 17eb8e4f8b ODT reader: Remove an unnecessary definition. 2026-06-09 10:04:53 +02:00
John MacFarlane 32d66351a6 ODT reader: don't create Emph just because of changed font.
Closes #11691.
2026-06-09 07:26:56 +00:00
John MacFarlaneandClaude 3a5f7ecee1 RTF reader: support legacy \pn/\pntext paragraph numbering (#11686).
Word-95-style numbered and bulleted lists are encoded with a
`{\pntext ...}` auto-number destination at the start of each list
paragraph plus a `{\*\pn ...}` destination describing the numbering,
rather than the modern `\listtext`/`\listtable` mechanism.  Two problems:

1. The `\pntext` marker text ("1.", "·", etc.) was captured as the
   paragraph's first text run, which sits before the paragraph's
   `\ls`/`\ilvl`, so emitBlocks (which reads list properties from the first
   run) misclassified the paragraph as an ordinary paragraph.  The first
   item of each list therefore came out as a stray paragraph.

2. The numbering style was ignored, so numbered lists defaulted to
   bullets.

Treat `\pntext` like `\listtext`: drop its visible marker text and flag the
start of a new list item.  Parse the `{\*\pn ...}` destination
(`\pnlvlbody`/`\pnlvlblt`, `\pndec`, `\pnucltr`, `\pnlcltr`,
`\pnucrm`, `\pnlcrm`, `\pnstart`, and the `\ls`/`\ilvl` keys it
carries) into the list override table so numbered lists are
emitted as ordered lists with the right number style.

`\pn` is a paragraph property that remains in effect until reset
by `\pard`, auto-numbering every paragraph in scope. Track
this (`sPnActive`) so each paragraph becomes its own list item,
rather than merging markerless continuation paragraphs as is done
for modern `\listtext` lists.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-09 08:49:17 +02:00
John MacFarlane 888a0062f1 Fix test for #11689 (use native) 2026-06-09 08:42:09 +02:00
John MacFarlane 0deb5e4907 Require pandoc-types >= 1.23.1.2 2026-06-09 08:33:46 +02:00
John MacFarlaneandClaude 656a6704a5 RTF writer: emit real RTF lists with a list table.
Lists were written as plain paragraphs with a literal marker and a
hanging indent, carrying none of the `\ls`/`\ilvl` references or the
`\listtable`/`\listoverridetable` that the RTF list model (and pandoc's
own reader) expect, so lists could not round-trip.

Walk the document tagging each list with a unique id and nesting level
(`prepareLists`), build a `\listtable`/`\listoverridetable` describing
each list (`listTableRTF`, exposed via the `listtable` template
variable), and render every list paragraph with its `\ls`/`\ilvl`
reference.  The first paragraph of each item gets a `{\listtext}`
marker; continuation paragraphs keep the reference but omit it, so
multi-paragraph items round-trip.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-09 00:17:57 +02:00
John MacFarlaneandClaude 9312f1da1b RTF reader: support multi-paragraph list items.
The reader treated every list paragraph as a new list item, so a list
item containing several paragraphs was split into one item per
paragraph.  In the RTF list model a new item is marked by a
`{\listtext ...}` destination group; a list paragraph lacking one is a
continuation of the current item.

Track whether a `{\listtext}` group was seen (`sListText`) and, in
`emitBlocks`, append a continuation paragraph (no `\listtext`) to the
current item rather than starting a new one.

Adds a `list_multiparagraph` reader test.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-09 00:17:20 +02:00
John MacFarlane 5566a6bf3c Docx reader: improve horizontal rule detection.
Previously we failed to detect horizontal rules when the
underlying XML contained text elements for semantically
insignificant whitespace. We also failed to handle the case
where a paragraph contains text and has a bottom border
property: this seems to be what Word does when you insert
a horizontal rule, e.g. by typing a series of hyphens or #
characters.

Closes #11689.
2026-06-08 23:49:22 +02:00
John MacFarlane aafcfa14b0 LaTeX reader: handle \hypertarget with one braced parameter.
This seems to work in LaTeX, no doubt because a single token
is consumed as the target text parameter.

Closes #7418.
2026-06-08 19:22:24 +02:00
John MacFarlane 16d66edb2a Typst writer: fold lang into pickTypstAttributes.
This ensures that `lang` attributes will be set for both
Divs and Spans. Closes #11673.
2026-06-06 22:49:45 +02:00
John MacFarlane 6c9b8ec557 Use emojis 0.1.5. 2026-06-06 14:28:04 +02:00
John MacFarlane 9d68bb83a7 T.P.Writers.Shared; htmlAttrs - don't add data- prefix for markdown.
This is necessary for the `markdown_attribute` extension to
work properly. Closes #11685.
2026-06-05 17:17:22 +02:00
John MacFarlane 833626838e Update flake.lock. 2026-06-05 13:52:07 +02:00
John MacFarlane 9376458c26 Circleci: put COPYING.md and COPYRIGHT in pandoc.wasm.zip. 3.10 pandoc-server-0.1.3 pandoc-lua-engine-0.5.3 pandoc-cli-3.10 2026-06-04 16:36:08 +02:00
John MacFarlane b2c5df98c1 Circleci: fix cache dir for wasm. 2026-06-04 13:04:36 +02:00