Skip to content

Support Pandoc's --math-method option in quarto render - #15321

Merged
cderv merged 2 commits into
mainfrom
fix/html-math-method
Nov 12, 2026
Merged

cderv merged 2 commits into
mainfrom
fix/html-math-method

Conversation

@cderv

@cderv cderv commented Nov 9, 2026

Copy link
Copy Markdown
Member

Stacked on #15320 (Pandoc 3.13).

Pandoc 3.11 added --math-method=METHOD[:URL] and deprecated --katex, --mathjax, --mathml, --webtex and --gladtex. With 3.13 bundled, quarto render --katex prints Pandoc's deprecation warning pointing to --math-method, but Quarto ignored that option when deciding which math method the command line chose. It kept acting on html-math-method (MathJax by default for Bootstrap HTML):

  • with --math-method=katex --embed-resources, Quarto injected its MathJax loader while Pandoc still emitted the KaTeX render call, so KaTeX was never embedded and math showed as raw TeX;
  • the KaTeX post-processing Quarto does for --katex did not run;
  • llms.md output lost the math delimiters and doubled backslashes.

Fix

quarto render now reads --math-method (and its optional URL) like the legacy flags, and the HTML math handling uses it as the command line choice. The argument still goes to Pandoc unchanged. Output with --math-method=X is now identical to output with the matching legacy --X flag.

The legacy flags are not translated to --math-method: they keep working, and Pandoc's deprecation warning stays, as its advice is now accurate.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone, Pandoc changelog and source
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

@cderv cderv mentioned this pull request Nov 9, 2026
3 of 5 tasks
@posit-snyk-bot

posit-snyk-bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv added this pull request to stack #15322 November 9, 2026 16:45
@cderv
cderv force-pushed the fix/html-math-method branch from c0c74e0 to b8e7dbc Compare November 10, 2026 16:39
@cderv
cderv force-pushed the fix/html-math-method branch from b8e7dbc to ad34fee Compare November 12, 2026 11:49
@cderv
cderv marked this pull request as ready for review November 12, 2026 14:05
@cderv cderv mentioned this pull request Nov 12, 2026
1 of 5 tasks
Base automatically changed from chore/deps-v1.12-pandoc to main November 12, 2026 17:00
Pandoc 3.11 added --math-method=METHOD[:URL] and deprecated --katex,
--mathjax, --mathml, --webtex and --gladtex, whose deprecation warning
now points users to the new option. Pandoc honours it, but Quarto only
looked at the old flags to learn which math method the command line
chose, so with --math-method it kept acting on html-math-method (MathJax
by default for Bootstrap HTML):

- with --embed-resources, the template patch swapped Pandoc's $math$
  for Quarto's MathJax loader while Pandoc's KaTeX render call stayed,
  so the KaTeX library was never embedded and math showed as raw TeX;
- the KaTeX post-processor (the require.js define guard) didn't run;
- llms.md output lost the math delimiters and doubled backslashes.

parseRenderFlags now records the method and optional URL, the HTML math
resolver returns it as a command line choice, and the template patch
asks the resolver instead of checking the five legacy flags. The rest
of mathConfig is left as is, so html-math-method behaves as before. The
argument still goes to Pandoc unchanged. Output with --math-method=X is
now byte-identical to output with the matching legacy --X flag.
@cderv
cderv force-pushed the fix/html-math-method branch from ad34fee to c54b99e Compare November 12, 2026 17:00
@cderv
cderv merged commit c444133 into main Nov 12, 2026
10 of 52 checks passed
@cderv
cderv deleted the fix/html-math-method branch November 12, 2026 17:03
cderv added a commit that referenced this pull request Nov 12, 2026
Regroup the Pandoc 3.13 entries in the 1.12 changelog the way earlier
Pandoc updates were recorded (see news/changelog-1.9.md). The update
line under Dependencies now lists only the Pandoc changes that alter
existing documents with no Quarto change. Quarto's own template and
style ports move under the format they affect, the section id change
goes under All Formats, and --math-method support goes under Commands.

See #15320, #15321 and #15344, which added the entries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants