











Back in 2022, I promised that R Markdown wouldn’t die. In this post, I’ll give a summary of notable updates in rmarkdown v2.26–v2.32 (2024–2026). For the full changelog, please see the release notes on GitHub.
A subtle bug could cause rmarkdown to silently overwrite the input .Rmd
file if certain conditions were met during rendering. This has been fixed
(#2534).
fig_crop: auto aligned with knitrThe output format option fig_crop: auto now uses the same logic as knitr
to decide whether PDF figure cropping is possible (checking for the pdfcrop
tool). Previously rmarkdown had its own, slightly different check that could
give inconsistent results
(yihui/knitr#2246).
stringr was used in only one place and the equivalent base R code is simple, so it was removed. One fewer transitive dependency for all rmarkdown users (#2530).
By default, rmarkdown writes HTML dependencies into a <name>_files/
directory. On Microsoft OneDrive and Google Drive this suffix can sometimes
cause the folder to be randomly deleted. You can now configure a different
suffix in your .Rprofile, e.g.,
options(rmarkdown.files.suffix = "_rmdfiles")
and the directory will be <name>_rmdfiles/ instead
(#2550).
A regression in 2.26 broke absolute image paths when output_dir is set.
Absolute paths pointing inside the output directory are now correctly made
relative to output_dir again.
beamer_presentation supports LaTeX dependenciesYou can now declare LaTeX dependencies for Beamer slides either via the new
extra_dependencies argument or from within a chunk, e.g.,
---
output:
beamer_presentation:
extra_dependencies: ["booktabs", "longtable"]
---
or inline:
knitr::asis_output("", meta = list(
rmarkdown::latex_dependency("longtable")
))
This makes it easier to include packages like longtable or booktabs without patching the LaTeX template (#2478).
Pandoc 3.2.1 changed how it names table row classes, dropping odd, even, and
header. rmarkdown now adds them back so existing CSS that styles table
rows continues to work
(#2567).
knit_params_ask() uses select for multi-value parametersWhen a parameter declared in YAML allows multiple values, the interactive
parameter dialog now shows a select (multi-choice) input instead of a radio
button, e.g.,
params:
primaries:
choices: ["red", "yellow", "blue"]
multiple: true
Previously a radio input was incorrectly used, making it impossible to select
more than one value at a time. Single-value parameters with fewer than five
choices still use radio by default (which is configurable)
(#2576).
The deprecated --no-highlight Pandoc argument was replaced with
--syntax-highlighting=none for Pandoc ≥ 3.8, and the long-obsolete |> / =>
syntax-highlighting workaround (unnecessary since Pandoc 2.18, over three years
ago) was removed (#2602,
#2290).
convert_ipynb() preserves raw cells without formatRaw notebook cells that have no format field in their metadata are no longer
silently dropped during conversion. For example, a cell like
{
"cell_type": "raw",
"source": ["some raw content"]
}
was previously lost; it is now passed through to the output (#2587).
render() fixed for .md → PDFA bug prevented render() from working when converting a plain .md file
directly to PDF. Fixed
(#2599).
pandoc_convert() errors when Pandoc is absentPreviously pandoc_convert() would fail silently or with a confusing message
when Pandoc was not available. It now throws an informative error immediately,
making the root cause obvious
(#2600).
Previously, base64-encoded images only worked correctly in HTML output. They now work in non-HTML formats (such as PDF) as well (#2604).
When rendering to PDF, LaTeX auxiliary files (.aux, .log, etc.) are now
written to output_dir rather than the input file’s directory. Previously
latexmk() ran in the input directory, so rendering failed when that directory
was read-only—common in production deployments or when the document lives in a
shared read-only location, e.g.,
rmarkdown::render("report.Rmd", output_dir = "docs/")
# Now works even if the directory containing report.Rmd is read-only
intermediates_dir PDF rendering fixedTwo related bugs with the intermediates_dir argument were fixed:
cannot open file '<name>.tex' error when Pandoc wrote the intermediate
.tex into intermediates_dir but rmarkdown looked for it in the input
directory. The .tex is now resolved to its actual location.keep_tex: true, the retained .tex is now moved next to the output
instead of being left behind in intermediates_dir
(#2183).lib_dir outside the output directoryHTML output no longer errors when lib_dir points outside output_dir, e.g.,
rmarkdown::render("a/report.Rmd",
output_dir = "a/",
lib_dir = "../shared-libs/")
Dependencies are now referenced with an up-tree relative path instead of failing
with "The path <file> does not appear to be a descendant of <dir>". This lets
documents in sibling subdirectories share a single library directory
(#146,
#1859,
#2199).
Support for Pandoc 1.x and early 2.x was dropped, removing several internal version guards. Pandoc 2.8 was released in 2019, so this should affect very few users in practice (#2623).
rmarkdown is now licensed under MIT (previously GPL-3) (#2615).
render() via fork clusters fixedWhen calling render() in parallel via parallel::mclapply() or a fork
cluster, processes could accidentally delete each other’s temp files because all
processes shared the same tempdir(). Temp files are now tracked per process,
so sibling renders no longer interfere
(#1632).
Captioned figures disappeared from ioslides_presentation() output when using
Pandoc 3, which represents standalone captioned images as Figure elements not
handled by the custom writer. rmarkdown now handles them correctly
(#2607).
I want to thank all contributors who filed issues or submitted pull requests for these releases: André Veríssimo (@averissimo), @atusy, Sebastian Meyer (@bastistician), Michal Burda (@beerda), @BerndGit, Brian Perdomo (@brianperdomo), @certara-tzweers, Christophe Dervieux (@cderv), Etienne Bacher (@etiennebacher), Gábor Csárdi (@gaborcsardi), Jiri Novotny (@gorgitko), Jonathan Guerra (@jonathan-g), @jsinnett, @jszhao, Jiří Moravec (@J-Moravec), Karan (@karangattu), @katrinabrock, Leonidas Zhak (@LeonidasZhak), Miriam Rainers (@mrainers), Rémi Thériault (@rempsyc), Siddhartha Bagaria (@siddharthab), Tomasz Kalinowski (@t-kalinowski), @therealgenna, Ruiyang Wu (@ywwry66).
In particular, I want to highlight Jonathan Guerra for his perseverance on the
PR #2199 for five whole years.
“Who speaks of victory? To endure (70+ times of git merge) is
all.”
Finally, I have had the time and courage to look at his PR and fix the problem
(apologies for the delay!), which has removed an unreasonable requirement in
rmarkdown’s lib_dir argument, and the original request goes all the way
back to 2014 with many upvotes on related issues! I’m really glad that this
problem is gone at last. Similarly, there have been some other long-lasting
annoying bugs like #1975 and
#1632, which were also
upvoted by many users and are now gone.
If you still use R Markdown (cool as a cucumber), I hope you will enjoy the new releases. As usual, please feel free to file issues or send pull requests on GitHub if you need anything. Thanks!
As a freelancer (currently working as a contractor) and a dad of three kids, I truly appreciate your donation to support my writing and open-source software development! Your contribution helps me cope with financial uncertainty better, so I can spend more time on producing high-quality content and software. You can make a donation through methods below.
Venmo: @yihui_xie, or Zelle: [email protected]
Paypal
If you have a Paypal account, you can follow the link https://paypal.me/YihuiXie or find me on Paypal via my email [email protected]. Please choose the payment type as “Family and Friends” (instead of “Goods and Services”) to avoid extra fees.
If you don’t have Paypal, you may donate through this link via your debit or credit card. Paypal will charge a fee on my side.
Other ways:
| WeChat Pay (微信支付:谢益辉) | Alipay (支付宝:谢益辉) |
|---|---|
![]() |
![]() |
When sending money, please be sure to add a note “gift” or “donation” if possible, so it won’t be treated as my taxable income but a genuine gift. Needless to say, donation is completely voluntary and I appreciate any amount you can give.
Please feel free to email me if you prefer a different way to give. Thank you very much!
I’ll give back a significant portion of the donations to the open-source community and charities. For the record, I received about $30,000 in total (before tax) in 2024-25, and gave back about $15,000 (after tax).
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。