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.
Given RST like
.. _target:
See |sub|.
.. |sub| replace:: `text <target_>`_
'pandoc -f rst -t html' produces
<div id="target">
<p>See <a href="##REF##target">text</a>.</p>
</div>
instead of the expected
<div id="target">
<p>See <a href="#target">text</a>.</p>
</div>
It formerly worked and regressed with c8fda8f4d ("RST reader: Use a new
one-pass parsing strategy."), release 3.6.
What happens is that during parsing pass 1 the `replace::` value `text
<target_>`_ is parsed to
Link nullAttr [Str "text"] ("##REF##target", "")
and is stored in ParserState's substitution table. Separately, '|sub|'
usage is parsed to
Link nullAttr [Str "|sub|"] ("##SUBST##|sub|", "")
and is stored in the document tree. resolveReferences then replaces the
placeholder in the document node with substitution table node during
walkM. However, the freshly substituted ##REF## placeholder was not
revisited further, and appeared unresolved in the output.
To fix it, we resolve the node recursively until the result contains no
more placeholder. We must protect from self-references to avoid
endless recursion.
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>
`t2t` is now supported as an output format, producing Txt2Tags
markup (<https://txt2tags.org>). The writer covers headers, lists
(bullet, ordered, definition), tables, links, images, code blocks,
inline formatting, and raw txt2tags/HTML passthrough.
[API change]
Adds a new module Text.Pandoc.Writers.Txt2Tags, exporting
`writeTxt2Tags`. Also exported from Text.Pandoc.Writers.
Co-authored-by: luginf <alan@luginf>
Clarify the risks of using pandoc in a web service and explain
how to do so more safely. Note some specific vulnerabilities
with the pdf-engine `wkhtmltopdf`.
This incorporates the suggestions made in #11262 and also
benefits from a report by Kai Aizen.
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.
Modified default template to remove custom show rule for
terms. Instead, we use a set rule to set hanging-indent.
For tight list items consisting of just one Plain block,
we no longer create a `#block` for the definition; this allows
it to remain on the same line as the term.
This just affects whether a blank line is emitted in the markup.
Note that pandoc's default template contains a show rule for
terms that will make these blank lines irrelevant, but this change
allows one to use tight lists with custom templates.
The fontsize is specified in a variable or metadata field
and passed through the renderer via a Reader monad.
Closes#11750.
Co-Authored-By: Claude <noreply@anthropic.com>
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.
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.
(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.
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.
...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.
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.
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>