Optionally abort on any Pandoc [WARNING] (#2638) - #2640
Merged
Merged
Conversation
Pandoc prints "[WARNING] Deprecated: <arg>. ..." on stderr for deprecated command-line arguments, but such arguments only warn -- they do not fail the conversion -- so they slip past our daily nightly-Pandoc CI job unnoticed until Pandoc eventually removes the argument (e.g. --mathjax deprecated in Pandoc 3.11). When the RMARKDOWN_PANDOC_WARN_DEPRECATED environment variable is set to a truthy value, pandoc_convert() now captures Pandoc's stderr (via system2(), which handles this portably, unlike a shell "2>" redirect that broke on Windows), relays it to the user, and turns any "Deprecated:" line into an R warning. This catches deprecations generically, without enumerating the deprecated arguments one by one. The behaviour is opt-in because capturing stderr changes how Pandoc's output is relayed; the flag is enabled in the check-pandoc-daily workflow so the nightly job flags deprecated arguments in advance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Broaden the opt-in stderr check to relay every "[WARNING] ..." line Pandoc prints (deprecated arguments, missing references, etc.) as an R warning, rather than matching only "Deprecated:". This way the nightly-Pandoc CI job fails on any Pandoc warning, not just deprecations. The environment variable is renamed RMARKDOWN_PANDOC_WARN_DEPRECATED -> RMARKDOWN_PANDOC_WARN accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ontext() The integration test used --citeproc to provoke a Pandoc [WARNING], but that option requires Pandoc >= 2.11 and errors out on Pandoc 2.8. Use duplicate header identifiers instead, which emit a [WARNING] on all supported Pandoc versions without failing the conversion. Also remove the testthat::context() calls, deprecated in the 3rd edition, which emitted "context() was deprecated" warnings during R CMD check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pandoc silently de-duplicates auto-generated header identifiers, so two
headers with the same text did not emit any [WARNING] and the expect_warning()
check failed on every Pandoc version. Give both headers the same *explicit*
identifier ({#dup}), which Pandoc reports as "Duplicate identifier" without
failing the conversion.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When RMARKDOWN_PANDOC_ERROR_ON_WARNING is set, pandoc_convert() captures Pandoc's stderr and stop()s on any "[WARNING] ..." message. The nightly-Pandoc workflow sets it so a new deprecation or other Pandoc warning fails the job. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
yihui
force-pushed
the
pandoc-warn-deprecated-args
branch
from
September 9, 2026 02:31
a320c30 to
6452a85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2639, split out because it needs to be opt-in.
Motivation
Pandoc prints
[WARNING] <message>on stderr for non-fatal issues — deprecated command-line arguments (#2638), missing references, etc. These only warn, they don't fail the conversion, so they slip past our daily nightly-Pandoc CI job unnoticed (a deprecated argument, for instance, stays silent until Pandoc eventually removes it).Approach
When
RMARKDOWN_PANDOC_ERROR_ON_WARNINGis set to a truthy value,pandoc_convert()(and hencerender()) captures Pandoc's stderr, relays it, and turns any[WARNING]line into an error. This catches any Pandoc warning generically — not only deprecations, and with no per-message enumeration.Design notes:
check-pandoc-daily.yaml, so the nightly job flags Pandoc warnings in advance.