Remove old ad hoc `paraToPlain` at the table cell level.
This should ensure that we don't get tables that mix
Plain and Para. Such tables tend to look funny when
rendered in docx and other formats.
Closes#11864.
With raw_html disabled (the default for the HTML reader), an inline
<style> element is now ignored rather than passed through as a
RawInline; the raw_html-enabled behavior is still tested.
Co-Authored-By: Claude <noreply@anthropic.com>
The `opt` parsers in LaTeX.hs and Citation.hs parsed the bracketed
tokens in a separate runParserT call, discarding any state changes
(macro definitions, labels, notes) made while parsing them. Since
an optional argument is not a TeX group, such changes should persist.
Use parseFromToks, which runs the sub-parse in the same parser run.
This also removes a per-optional-argument state copy.
Co-Authored-By: Claude <noreply@anthropic.com>
Commit 47610fe3d (#10781) disabled the `--`, `---`, and `"` ligatures
inside `\texttt`, but single `` ` `` and `'` characters were still
converted to curly quotes, so `\texttt{it's}` produced code containing
a Unicode right single quotation mark. Gate those conversions on the
ligatures flag too, so quote characters inside `\texttt` stay as
typed. Update test/command/3958.md accordingly.
Co-Authored-By: Claude <noreply@anthropic.com>
`tokenize pos` already produces tokens positioned relative to pos,
but the result was then shifted again by pos's line and column,
roughly doubling the reported positions of tokens retokenized from
comments in URL arguments. Tokenize from the position just after
the '%' instead, and drop the extra shift.
Co-Authored-By: Claude <noreply@anthropic.com>
When tokenizing `##` not followed by digits, the continuation
restarted at column pos+1 instead of pos+2, shifting the source
positions of all subsequent tokens on the line one column left.
Co-Authored-By: Claude <noreply@anthropic.com>
role="img" and an aria-label copied from alt were being added to
every element with a src-like attribute, not just inlined SVGs.
That is redundant on img elements, whose alt already provides the
accessible name, and actively wrong on elements like video, audio,
iframe, and embed, where role="img" misrepresents interactive
content as a static image to assistive technology.
The attributes are only needed when an img element is replaced by
an inline svg element, since the alt text loses its meaning there;
restrict them to that path. Inline SVG output is unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
Support the features described in the LaTeX usrguide
(https://www.latex-project.org/help/documentation/usrguide.pdf):
- `\New/Renew/Provide/DeclareDocumentCommand` and the corresponding
`...DocumentEnvironment` commands, with argument specifiers
`m o O d D s t r R v e E b` and argument processors (`>{...}`:
`\TrimSpaces`, `\ReverseBoolean`, `\SplitArgument`, `\SplitList`).
Environment end code can refer to the environment's arguments.
- `\ProcessList`, `\UseName`, and `\ExpandArgs` (c, n, N letters).
- The conditionals `\IfNoValueTF`, `\IfValueTF`, `\IfBooleanTF`,
`IfBlankTF` (and variants with just `T` or `F`).
- `\New/Renew/DeclareCommandCopy` and `...EnvironmentCopy`.
- Case changing: `\MakeUppercase`, `\MakeLowercase`, and
`\MakeTitlecase`, `\NoCaseChange`,
`\Declare{Upper,Lower,Title}caseExclusions`; `\CaseSwitch` and
`\Declare*caseMapping`.
- The expandable evaluators `\inteval` and `\fpeval` (a practical
arithmetic subset); `\dimeval` and `\skipeval` substitute their
expression unevaluated.
- `\expandableinput`.
- `\ExplSyntaxOn/Off` regions are tokenized with `:` and `_` as
letters, so expl3 code can be skipped cleanly; `\ShowCommand` and
the ltkeys commands (`\DeclareKeys`, `\SetKeys`,
`\ProcessKeyOptions`, ...) are parsed and ignored.
- Some constants, such as `c_ampersand_str`, are supported in
expl3 regions.
Adds new `ArgSpec` constructors to non-exported module Text.Pandoc.TeX.
New tests in `test/command/latex3-commands.md` and
`test/command/latex3-usrguide.md`. (The latter correspond to the
examples in the user guide and were confirmed against LaTeX output
when possible.)
Closes#7540.
Co-Authored-By: Claude <noreply@anthropic.com>
Previously it was not looking in the right directory
and not recursing.
The function now alphabetizes its results so that test output
is the same with or without `embed_data_files`.
The keywords (e.g. `TIP`) for GFM-style alerts need not be all caps.
This commit fixes that. It also adds the class `alert` to the produced
Divs to allow for namespacing.
This commit changes the emitted classes from the alert extension
of the basic Markdown reader to add the class `alert` to the
produced DIVs to allow for namespacing.
This replaces (now deprecated but still functional) options
`--mathml`, `--mathjax`, `--gladtex`, `--katex`, `--webtex`.
The `plain` style can now be specified explicitly.
In defaults files, `html-math-method` is now
`math-method` (though `html-math-method` will still work).
Text.Pandoc.App.Opt:
- In unexported type CompletionKind, add MathMethods.
- In Opt, change `optHTMLMathMethod` to `optMathMethod`. [API change]
Text.Pandoc.Options:
- Rename HTMLMathMethod type to MathMethod. [API change]
- Rename `writerHTMLMathMethod` field of WriterOptions to
`writerMathMethod`. [API change]
Text.Pandoc.App.Completion:
- Clean up code.
- Add support for `--math-method`.
RTL is now properly handled in these cases:
- `dir: rtl` (or `ltr`) in document metadata
- an RTL `lang` in metadata (e.g. `he`, `ar`), unless overridden
by `dir`
- a `dir` attribute on a Div
The OpenDocument writer tracks the active writing mode and, when it
is RTL, emits automatic paragraph styles with
`style:writing-mode="rl-tb"` derived from the usual named styles
(deduplicated per parent style). `fo:text-align` is also used
to get the matching text alignment.
Code blocks remain ltr regardless.
Closes#11301.
With some help from Claude Fable.
Make `--bash-completion` an alias of `--completion=bash`.
Reorganize option parsing code using a new data structure OptionSpec,
which can encode the type of completion needed by each option.
Add new unexported module Text.Pandoc.Completion.
Unexported module Text.Pandoc.CommandLineOptions: export OptionSpec.
Closes#8542.
See 185c29b4b2 which claims that
`block` can occur in inline contexts. I can no longer confirm
this and suspect that it may have been an unintended behavior
of earlier versions of typst, now fixed.
Closes#11814.
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.
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.
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>
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.
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.
...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.
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>
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.