Drop support for Pandoc 1.x/2.x (require Pandoc >= 3.0)#2623
Conversation
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>
|
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 rmarkdown/inst/rmarkdown/lua/shared.lua Lines 78 to 79 in 194c2a1 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.
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. I'll ask around at Posit if we know organization with such constraint. |
Motivation
Follow-up to #2622. In that PR, the new
extract-data-uri.luafilter (which replaced--extract-media) was noted by @bastistician to be more complex than necessary because it had to cope with Pandoc 2.x quirks (unreliablepandoc.mediabagfor data URIs, missingpandoc.utils.sha1, missingpandoc.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 viapandoc.mediabag.fetch()instead of the hand-rolled base64 decoder, and usepandoc.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 usespandoc.system.make_directory(added in 2.19); dropped the Windows/mkdir -pshell fallbacks.pandoc_type()always usespandoc.utils.type(added in 2.17).number-sections,latex-div,pagebreak).R
pandoc2.0()and the manypandoc_available("1.x"/"2.x")branches and dead code paths, including: thepandoc-citeprocfilter path,--latex-engine,--atx-headers, themarkdown_githubvariant, thesubtitle.texpatch (Pandoc < 2.6),fix_horiz_rule()(< 2.8), theaccessible-code-blockHTML 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
inst/rmd/latex/subtitle.texandinst/rmd/h/accessibility/empty-anchor.js.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/#2620regression tests added in #2622 still pass with the simplified filter.🤖 Generated with Claude Code