1319 Commits
Author SHA1 Message Date
John MacFarlane 3acfe775e6 LaTeX writer: omit empty caption on unnumbered tables.
(Even if they have an identifier.)

Closes #11795.
2026-08-11 11:22:12 -07:00
John MacFarlane 7c35a540d1 Revert "Typst writer: fix escaping of quotes."
This reverts commit 04848401d5.

However, we retain the test for #11463, which didn't actually
need the reverted commit.

Closes #11788.
2026-08-11 09:35:17 -07:00
John MacFarlane 87bc462713 Typst writer: make writer sensitive to typst-label attribute.
If this attribute is set, the writer will output a label.
(This overrides labels based on identifiers, when identifiers
are present.)

Note that labels in typst need not be unique and may be used to
style elements using show rules.  For example, one can attach
an `excerpt` label to all Divs that are excerpts, and style this
using a show rule like `#show <excerpt>: set text(blue)`.

See discussion at #11794.
2026-08-07 10:39:33 -07:00
John MacFarlane 12a44fbb98 Markdown raw HTML: fix handling of void hr element.
Closes #11793.

Added `voidTags` to unexported module
Text.Pandoc.Readers.HTML.TagCategories.
2026-08-05 07:18:12 -07:00
John MacFarlane db8d64fe6f Markdown writer: Fix ordered list bug.
Previously ordered lists starting with a code block did not
round trip. Pandoc uses an indented code block, and according
to commonmark rules only one space is gobbled after the list
marker; however, pandoc added two.  This has now been fixed.
An incidental change fixes an oddity in markua list indentation.

Closes #11762.
2026-07-14 17:34:15 +02:00
ce37e24c6a PPTX writer: keep tables and surrounding text on same slide (#11411)
Previously, when a slide contained bullet points before and after a
table, content would be split across multiple slides or use a two-column
layout that didn't preserve the source order.

This change:

1. Modified `splitBlocks'` in Presentation.hs to continue accumulating
   content after tables instead of immediately splitting to a new slide.

2. When a slide has a table with surrounding text, use ContentSlide
   (single column) instead of ContentWithCaptionSlide (two columns)
   to preserve content order.

3. Added vertical stacking in Output.hs (shapesToElementsStacked) to
   properly position multiple shapes (tables + text) within a content
   area. Space is allocated proportionally based on content size
   (paragraphs and table rows).

Closes #11433.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Chris Callison-Burch <ccb+github@upenn.edu>
2026-07-12 12:51:11 +02:00
Chirag Dhamange 432414c236 Fix: GFM empty task list conversion to ballot (#11744)
Extend `taskListItemToAscii` to cover empty task lists.
Closes #11599.
2026-07-12 12:01:23 +02:00
John MacFarlane 780e605c95 Texinfo writer: fix escaping in links.
Previously we dropped periods, commas, etc. This was a regression
from 2024. All we really need to do is escape the comma.

Closes #11758.
2026-07-11 10:57:33 +02:00
John MacFarlane 3ecd95bf00 LaTeX writer: Provide a way to use table instead of longtable.
When the `float` class is attached to a table, a standard
floating `table` will be generated instead of a `longtable`.
Placement can be specified via the `latex-placement` attribute.
This will help, especially, those who use two-column layouts,
since `longtable` is incompatible with these.

Small change to the default LaTeX template: the `caption`
package is included and a default spacing set between the caption
and the table.

Closes #1023.
2026-07-10 16:38:03 +02:00
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
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 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 612e143fbe DokuWiki reader: skip non-cell content after table row.
Closes #11739.
2026-06-29 19:28:54 +02:00
John MacFarlane 1c22498269 LaTeX writer: fix footnotes in def list headings.
Closes #8240.
2026-06-29 11:40:30 +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
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 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
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 888a0062f1 Fix test for #11689 (use native) 2026-06-09 08:42:09 +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 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 MacFarlaneandClaude 098c48d79f RTF reader: fix tables parsed as deeply nested tables.
Closes #11682.

Fixes two bugs that caused a simple table to be read as a cascade of
nested tables:

* `\plain` reset the entire property record (including the in-table
  flag) via `const def`.  When a cell paragraph used `\plain` after
  `\intbl`, the in-table flag was cleared, so the next `\cell` closed
  the partially-built table and embedded it inside a new cell.  Per the
  RTF spec, `\plain` should reset only character formatting, so it now
  preserves paragraph/context properties (in-table, list level, outline
  level, hyperlink, anchor).

* `\row` was ignored and only `\trowd` started a new row.  Real-world
  RTF often emits a single `\trowd` and separates rows with `\row`, so
  every cell ended up in one row.  Both `\trowd` and `\row` now begin a
  fresh row (only when the current one has cells), and empty trailing
  rows are dropped when closing the table.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-03 16:36:29 +02:00
Meher Chaitanya 1ffeb856ee Add auto_identifiers support to Man Reader (#11675)
Add support for the `auto_identifiers`, `gfm_auto_identifiers`, and
`ascii_identifiers` extensions in the man reader. Section headings
parsed from .SH and .SS macros now receive auto-generated id
attributes when the extension is enabled, enabling `--toc` to
produce working anchor links.

- Add `autoIdExtensions` to default man extensions [behavior change]
- Add `HasReaderOptions`, `HasLogMessages` and `HasIdentifierList` to
  `ManState` to run `registerHeader`

Closes #8852.
2026-05-30 19:11:14 +02:00
Johan Larsson 41f829c43d Markdown reader: allow grid tables to be indented. (#11671)
Like the other table syntaxes (pipe, simple, and multiline tables) and
block-level constructs generally, a grid table may now be indented by up
to three spaces and still be recognized as a table.  Previously the
grid-table parser required the table to begin at the left margin, so an
indented grid table was parsed as a paragraph.

The leading indentation is stripped uniformly from each line before the
table is parsed, so an indented grid table produces the same AST as its
non-indented equivalent.

Adds a command test.
2026-05-28 00:07:29 +02:00
John MacFarlane 1c7cfb2a2a OpenDocument/ODT writer: use predefined styles. (#11672)
Previously the OpenDocument writer emitted a fresh automatic style
(L1..Ln, P1..Pn, T1..Tn) for nearly every list, list-item paragraph,
block quote, preformatted block, and inline text style.  This produced
large ODT files, made `--reference-doc` customization ineffective (the
user's predefined styles were never referenced), and gave each list its
own indentation independent of any containing block quote.

This commit teaches the writer to reference the predefined styles that
LibreOffice ships and that pandoc's reference.odt now exports:

- Bullet lists use `List_20_1`; ordered lists with default start and
  decimal format use `Numbering_20_1`.  Non-default ordered lists
  generate a single named override style (`Pandoc_Numbering_N`)
  memoised by (ListNumberStyle, ListNumberDelim); a non-default start
  value with the default format is expressed via `text:start-value`
  on the `text:list` element instead of a new style.
- List-item paragraphs use `List_20_Bullet[_Tight]` and
  `List_20_Number[_Tight]`.  The Tight variants are pandoc-specific
  (zero top/bottom margin) and are injected into the user's
  reference.odt if missing, just like the Skylighting token styles.
- Block quotes use the predefined `Quotations` paragraph style
  directly.  Nested block quotes use a single automatic style that
  inherits from Quotations and only adds extra margin-left, so a list
  inside a block quote now inherits its container's indent (#2747).
- Preformatted blocks use `Preformatted_20_Text` directly.
- Emphasis, Strong, Strikeout, Subscript, Superscript and Code spans
  use the predefined `Emphasis`, `Strong_20_Emphasis`, `Strikeout`,
  `Subscript`, `Superscript` and `Source_20_Text` text styles.
- `paraStyle`/`paraStyleFromParent` no longer emit a wrapper automatic
  style when its only attribute would be `parent-style-name`; the
  parent name is returned directly.

Closes #9136.
Closes #5086.
Closes #2747.
Closes #3426.
Closes #7336.

Co-authored by: Claude Opus 4.7.
2026-05-27 17:35:39 +02:00
John MacFarlane d37f306299 Man reader: better handling of .TP macro.
We parse these as DefinitionList items, but we previously
sometimes stopped prematurely in including material in the
definition.  We should include everything until we hit a new
indentation-changing macro.

Closes #11668.
2026-05-26 12:57:29 +02:00
John MacFarlane 646eeb6614 gridTable: fix calculation of column widths for default columns.
This fixes a bug which produced too-narrow columns in some cases.

Closes #11664.
2026-05-23 18:09:46 +02:00
nibras shami 0640c4c985 EPUB writer: support multiple EPUB versions for raw content (#11628).
This change ensures that raw content marked `epub2` will appear in (only) EPUBv2 output
and content marked `epub3` will appear in (only) EPUBv3 output.
2026-05-17 11:02:34 +02:00
John MacFarlane b43762cdc4 Error messages: use single quotes around paths and format names.
Closes #11645.
2026-05-13 17:15:34 +02:00
John MacFarlane b8a0e5e85d Roff reader: handle \ line continuation in table cells.
Closes #11635.
2026-05-11 12:30:20 +02:00
John MacFarlane 7825bd001c Markdown reader: don't produce empty Raw element with --strip-comments.
Closes #11625.
2026-05-07 12:10:23 +02:00
John MacFarlane 45c31661b2 LaTeX reader: evaluate theorem name when used...
rather than evaluating it when the `\newtheorem` command
is encountered. It may include macros only defined later.
Closes #11608.
2026-05-02 13:07:00 +02:00
John MacFarlane 672e745839 LaTeX reader: put identifier from label on table attributes...
rather than adding an enclosing Div.

Closes #11604.
2026-05-01 00:15:40 +02:00
John MacFarlane f74179a5d8 Typst reader: Fix issue parsing figure inside rotate or box.
Closes #11598.
2026-04-24 10:55:52 +02:00
John MacFarlane c15e062867 Markdown reader: allow spaces inside attributes in super/sub.
Closes #11589.
2026-04-18 23:19:15 +02:00
John MacFarlane aa571d2c41 Add --typst-input CLI option.
This allows one to pass parameters to typst, which are available
at `sys.inputs`, just as `typst` itself does with its `--input`
option.

[API changes]

* ReaderOptions has a new field `readerTypstInputs`.
* Opt has a new field `optTypstInputs`.

Closes #11588.
2026-04-18 13:05:35 +02:00
John MacFarlane 38a23550bb Typst writer: newline after #set text directive.
This ensures that blocks such as lists are parsed correctly
after a `set text`.

Closes #11583.
2026-04-15 22:25:11 +02:00
John MacFarlane 3fc374908c Docx reader: don't look to ext tags for image extent.
This was added in 7ff1b798c4
but was mistaken and could cause images to be parsed with
the wrong sizes.

Closes  #11580.
2026-04-13 12:04:02 +02:00
John MacFarlane a6486391e1 Markdown writer: escape ::: to avoid triggering unintended divs.
Closes #11571.
2026-04-09 10:51:15 +02:00
John MacFarlane 7aca987b95 MediaWiki writer: handle some technically malformed URLs.
E.g. `http://example.com/#/#room` and `http://example.com/##`. Closes #11562.
2026-04-04 15:27:01 -04:00
John MacFarlane df61b8b1a9 MediaWiki writer: fix escaping to avoid lists.
For paragraphs beginning with literal `#`, `*`, or other things
that would otherwise produce lists, we insert `<nowiki></nowiki>`
rather than (as previously) `\`. `\` does not work to escape
these.

Closes #11563.
2026-04-04 15:12:23 -04:00
John MacFarlane 7777de6adb BibLaTeX inbook should be CSL book, not chapter.
Closes #11552.
2026-03-27 23:56:08 -04:00
John MacFarlane 397fef7900 LaTeX template: Define \xmpquote if not defined.
`\xmpquote` is defined by the hyperref driver hyperxmp; we need a
fallback for those who aren't using that.

Closes #11528.
2026-03-22 10:36:15 +01:00
John MacFarlane 8ce63ffe28 Mardkown writer: fix spacing issues with definition lists.
- Properly handle the case where the first item is an indented
  code block.  (Closes #11542.)
- Use correct indentation when `four_space_rule` extension is
  disabled.
2026-03-20 11:39:01 +01:00
John MacFarlane ef6b669e25 Markdown reader: Fix bug with lists_without_preceding_blankline.
This was not properly implemented, causing some unintended
results. Closes #11534.
2026-03-17 19:37:08 +01:00
John MacFarlane 80c704a9ac Typst writer: properly escape . after bracketed argument.
(When it might be mistaken for field access.)

Closes #11511.
2026-03-09 14:10:53 +01:00
massifrg 15ddf4124c ICML writer support for image object styles (#11498)
This change allows users to style images in InDesign bysetting the
`object-style` attribute in a pandoc Image, which is mapped to the
AppliedObjectStyle attribute in the Rectangle element around
an Image element in the resulting ICML.
2026-03-03 22:31:55 +01:00