Skip to content

Drop support for Pandoc 1.x/2.x (require Pandoc >= 3.0)#2623

Draft
yihui wants to merge 4 commits into
mainfrom
drop-pandoc-2x
Draft

Drop support for Pandoc 1.x/2.x (require Pandoc >= 3.0)#2623
yihui wants to merge 4 commits into
mainfrom
drop-pandoc-2x

Conversation

@yihui

@yihui yihui commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Follow-up to #2622. In that PR, the new extract-data-uri.lua filter (which replaced --extract-media) was noted by @bastistician to be more complex than necessary because it had to cope with Pandoc 2.x quirks (unreliable pandoc.mediabag for data URIs, missing pandoc.utils.sha1, missing pandoc.system.make_directory). @yihui agreed it may be time to drop Pandoc 2.x, and @cderv confirmed that current Ubuntu releases ship Pandoc 3+.

Pandoc 3.0 was released over three years ago. This PR raises the minimum required version from 1.14 to 3.0 and removes the version guards and fallbacks that only existed for older Pandoc.

Changes

Lua filters

  • extract-data-uri.lua: decode data URIs via pandoc.mediabag.fetch() instead of the hand-rolled base64 decoder, and use pandoc.utils.sha1() unconditionally for the extracted filename. This is the simplification Replace --extract-media with Lua filter to fix _files/ cleanup regression #2622 asked for (net −52 lines in this file).
  • shared.lua: make_directory() always uses pandoc.system.make_directory (added in 2.19); dropped the Windows/mkdir -p shell fallbacks. pandoc_type() always uses pandoc.utils.type (added in 2.17).
  • Dropped the Pandoc 2.1 version guards from the bundled filters (number-sections, latex-div, pagebreak).

R

  • Removed pandoc2.0() and the many pandoc_available("1.x"/"2.x") branches and dead code paths, including: the pandoc-citeproc filter path, --latex-engine, --atx-headers, the markdown_github variant, the subtitle.tex patch (Pandoc < 2.6), fix_horiz_rule() (< 2.8), the accessible-code-block HTML dependency (2.7.3–2.9.2.1), the beamer template patches (< 1.17.3), and the ioslides Windows codepage workaround.
  • render() now requires Pandoc 3.0.

Resources / tests

  • Removed the now-unused inst/rmd/latex/subtitle.tex and inst/rmd/h/accessibility/empty-anchor.js.
  • Updated tests to drop the corresponding old-Pandoc branches and skips.

Net: +69 / −464 lines.

Testing

Affected test files pass locally against Pandoc 3.6.3 (test-pandoc, test-lua-filters, test-md_document, test-github_document, test-powerpoint_presentation, test-pdf_document, test-html_document, test-beamer_presentation, test-ioslides_presentation). The #2604/#2620 regression tests added in #2622 still pass with the simplified filter.

🤖 Generated with Claude Code

yihui and others added 4 commits July 8, 2026 19:29
Pandoc 3.0 was released more than three years ago and current Linux
distributions ship Pandoc 3.x, so this raises the minimum required
version from 1.14 to 3.0 and removes the version guards and fallbacks
that existed only to support older Pandoc.

Follow-up to #2622, where the base64 data-URI extraction filter was
noted to be more complex than necessary because it had to cope with
Pandoc 2.x behaviour.

- extract-data-uri.lua: use pandoc.mediabag.fetch() to decode data
  URIs instead of a hand-rolled base64 decoder, and pandoc.utils.sha1()
  unconditionally for the extracted file name (both stable in Pandoc 3).
- shared.lua: make_directory() now always uses
  pandoc.system.make_directory (added in 2.19); drop the shell
  fallbacks. pandoc_type() always uses pandoc.utils.type (added 2.17).
- Drop the Pandoc 2.1 version guards from the bundled Lua filters.
- R: remove pandoc2.0() and the many pandoc_available("1.x"/"2.x")
  branches, dead code paths, and helpers that only ran on old Pandoc
  (pandoc-citeproc filter, --latex-engine, --atx-headers,
  markdown_github variant, subtitle.tex patch, fix_horiz_rule,
  accessible-code-block dependency, beamer template patches, ioslides
  codepage workaround, etc.).
- Remove now-unused resources inst/rmd/latex/subtitle.tex and
  inst/rmd/h/accessibility/empty-anchor.js.
- Update tests to drop the corresponding old-Pandoc branches/skips.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
rmarkdown now requires Pandoc >= 3.0, so testing 2.x versions is no
longer meaningful. Keep 3.0 (the new floor) and 3.1.11, plus
latest/nightly. Retarget the coverage step from 2.19.2 to 3.1.11.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rstudio rstudio deleted a comment from github-actions Bot Jul 9, 2026
@rstudio rstudio deleted a comment from github-actions Bot Jul 9, 2026
@rstudio rstudio deleted a comment from github-actions Bot Jul 9, 2026
@rstudio rstudio deleted a comment from github-actions Bot Jul 9, 2026
@yihui
yihui requested a review from cderv July 9, 2026 01:53
@cderv

cderv commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

My main concern with this idea of dropping support entirely is the support for organization, and entreprise that moves very slowly ! Old system where pandoc 2 would still be used, possibly shipped through an old RStudio.

It is hard to know for sure but this is a worry.

The problem with the lua script is really that ideally we need pandoc 2.8 which is from 2019 - which is 7 years now

if pandocAvailable({2, 8}) and pandoc.system and pandoc.system.make_directory then
pcall(pandoc.system.make_directory, path, true)

Pandoc 3 is only from 2023 and major bump. 🤷‍♂️

I see this allows to replace some pandoc 2.19 requirements too - so maybe this is oldest we could keep with this change ? pandoc 2.19 requirement , and not pandoc 3 ?

In a way we remove Pandoc 1 support, and we bump minor to latest pandoc 2 minor, and soon will support pandoc 3 only ?

I guess for such change I was thinking we would need to do a deprecation mechanism.

  • Do a release by throwing a message or a warning in all system that use Pandoc 2, saying we will change to pandoc 3 , and maybe reach out in an issue to explain to us why pandoc 3 would be a problem ?

R Markdown is widely use. In many private and unknown environnment - so I am extra careful. Especially because R works in a way where using latest available CRAN package is a standard, and locking package version is not widely used (I think).

So I wonder of the possible side effect, and if this is worth the risk.
do we gain much to finally makes this Pandoc version support bump ?
If we want to go through, what about this idea of going in a deprecation cycle like manner ?

I'll ask around at Posit if we know organization with such constraint.

@yihui
yihui marked this pull request as draft July 9, 2026 13:53
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