Releases: rstudio/rmarkdown
rmarkdown 2.9
-
Fix a regression in version 2.8 when a url is used in
css
argument (thanks, @vnijs, #2163). -
All HTML dependencies are now correctly supported, included those with only an
href
component but notfile
component in theirsrc
attribute. Previously, rmarkdown would throw the error'path for html_dependency not provided'
when rendering documents containing HTML dependencies withhref
components (thanks, @crazycapivara, @matthewstrasiotto, #1805, #1948, #2151). -
Fix an error thrown with output format using a
file_scope
function (like in bookdown) (thanks, @rfaelens, #2149). -
Fix an issue with
copy_ressource = TRUE
inhtml_document_base
where very long HTML documents were truncated during post processing (thanks, @oliviermeslin, #2145). -
When
run()
-ing aruntime: shiny
document, an extra temp folder will be used in the output path. With the extra temp random folder in the path, predictable output file names may be used. (#2137) -
When
run()
-ing aruntime: shiny
document with a{bslib}
theme, the global theme value wasn't being restored properly. (#2160) -
Floating ToC in
html_document
can now hide headings with unnumbered and unlisted classes (thanks, @atusy, #1993). -
Fix prefix handling in R Markdown website's navbar for Fontawesome V5 and compatibility with V4. For icon only available in V5, the full prefix + name should be use, especially with new
fab
prefix (e.g.fab fa-r-project
). If no prefix is used (e.gfa-home
instead offas fa-home
), thefa
prefix will be added for V4 compatibility as it has been deprecated in V5. We advice to use the full prefix + name for icons following Fontawesome documentation. (#1994) -
rmarkdown::site_generator()
can hang session waiting for input when thesite
field is not found in the YAML frontmatter ofindex.Rmd
(thanks, @kevinushey @mirh, #2043).
rmarkdown 2.8
-
Fix a issue with Pandoc 2.5 and
latex-div.lua
- documents can now be rendered as expected without error (thanks, @DAVIDWALES, #2121). -
Fix an issue with styling and code folding button behavior when default is
code-folding: show
. The Button can now be correctly style according to state asaria-expanded
attributes is correctly updated. Also, new classes has been added on the button to allow styling during transition:btn-collapsing
andbtn-expanding
are respectively applied during transition Show to Hide and Hide to Show. (This follow Bootstrap behavior for the collapsible block) (thanks, @steveharoz, #2085). -
Fix an issue with
citation_package
having no effect when using.md
file as input torender()
with latex and PDF output formats (thanks, @andrewheiss, #2113). -
A new internal option
rmarkdown.knit.ext
has been added to control the extension of the intermediary knit output during a rendering. It defaults tomd
to produce*.knit.md
. Only useful for very advanced usage (#2098). -
render()
won't produce any*.utf8.md
intermediary file anymore. This was a leftover from previous versions of rmarkdown. Since knitr 1.24 and rmarkdown 2.0, only UTF-8 input files are allowed. (#2098). -
Fix an
Invalid cross-device link
error whentempdir()
is used forintermediates_dir
inrender()
(thanks, @gorgitko, #2096). -
Fix a regression in HTML default template with floating toc incorrectly placed on small size window (thanks, @grimbough, #2071)
-
Provided a
runtime: shiny
fix for output formats that pass a modifiedbslib::bs_theme()
object tohtml_document_base()
'stheme
(thanks, @cpsievert, #2049). -
Rendering using
runtime: shiny_prerendered
orruntime: shinyrmd
will now produce valid HTML by not inserting anymore the full document as body in the resulting shiny apps (thanks, @dakep, #1912). Header content usually containing html dependencies will be inserted in the HTML document at the end of the head before</head>
, unless the rendered HTML contains<!-- HEAD_CONTENT -->
special comment (seehtmltools::renderDocument()
). A new Pandoc variable is set in for shiny prerendered document to allow conditional insertion of such content in the the HTML template using$if(shiny-prerendered)$
. This has been done in all HTML template in this package. Users of custom template should make this change to provide support for this runtime. See rmarkdown default template (default.html
) for an example (#2064). -
Added
tectonic
as a supported LaTeX engine for generating PDF output (thanks, @dpryan79, #2078). You can specify to use this by addingengine: "tectonic"
to your output format in YAML, such aspdf_document
. -
When no
output_format
is provided in any way but anoutput_file
is provided inrender()
, the default format will be determined based on the extension:"pdf_document"
for.pdf
, or"word_document"
for.docx
. Otherwise, it will be"html_document"
as previous version (thanks, @pearsonca, #1569). -
Added a new global option
rmarkdown.render.message
. When setFALSE
,render()
will not output the message starting byOutput created:
allowing RStudio IDE to open a preview of the document. This is useful for package developers that would need to emit there own output message for there custom format. See?render_site
for more info on this special message (#2092). -
Internal changes regarding Lua filters. They have now an explicit Pandoc version minimal requirement: A filter will be skipped with a warning printed by the Lua filter if this requirement is not met. For now, all filters work for Pandoc 2.1 and above (thanks, @atusy, #2088). There is also now a new mechanism to have a share Lua filter script loadable by other Lua files:
render()
will set theRMARKDOWN_LUA_SHARED
env var to the path of Lua filtershared.lua
so that other filters can access functions defined in it usingdofile(os.getenv 'RMARKDOWN_LUA_SHARED')
. This is for internal usage only to avoid duplication (thanks, @tarleb, #2103). -
html_document_base
gains acss
argument, to whichhtml_document
'scss
argument is now passed. This also fix an issue when.sass
or.scss
files are used with thiscss
argument whenself_contained: FALSE
. Moreover, sass caching mechanism can now be used when passing.sass
or.scss
files to thecss
argument (thanks, @cpsievert, #2095). -
The
fig_crop
option of PDF document formats (such aspdf_document
andbeamer_presentation
) supports the value"auto"
now, which meansfig_crop = TRUE
when figure cropping toolspdfcrop
andghostscript
are available. -
The default value of the
fig_crop
option of PDF output formats has been changed fromTRUE
to"auto"
(#2077). -
rmarkdown::tufte_handout
has been deprecated and will be removed in the future from this package. It has been moved to the tufte package since rmarkdown 0.9.5 (released on 2016-02-22). Please usetufte::tufte_handout
instead.
rmarkdown 2.7
-
html_document
(andhtml_document_base
)'stheme
parameter now understandsbslib::bs_theme()
objects/arguments, meaning that one may opt-into Bootstrap 4 and more easily create custom themes. For examples, see #1706, and for context, see https://rstudio.github.io/bslib/ (thanks, @cpsievert, #1706). -
Files with
.scss
/.sass
extension (i.e., Sass files) provided tohtml_document
'scss
parameter are now compiled to CSS using the{sass}
package. Also, iftheme
is a{bslib}
object, these Sass files may utilize Sass code inside thetheme
(thanks, @cpsievert, #1706). -
Fix an issue with line numbering in code chunks when
.numberlines
with Pandoc's highlighting (thanks, @aosavi, #1876). -
Fix an issue with shiny runtime and
global.R
(thanks, @liaojiahui-r, rstudio/flexdashboard#298). -
Accept
latex="{options}"
,latex=1
, orlatex=true
for Latex Divs. -
Add
output_format_filter
function todefault_site_generator()
. Enables custom site generators to customize or even entirely replace the output format right before rendering of each page. -
Automatically exclude renv directory for
render_site()
(thanks, @jmbuhr, #1996) -
Do not force
options(htmltools.preserve.raw = TRUE)
when this option has been set, otherwise it is impossible for other packages to turn this option off, e.g., yihui/xaringan#293. -
knitr_options_pdf()
will now throw a warning whenfig_crop = TRUE
but is disabled because required toolspdfcrop
and/orghostscript
are missing (thanks, @netique, #2016). -
Eliminated the unnecessary padding in code blocks in the
html_document
output with Bootstrap 4 themes (thanks, @atusy, #2019). -
github_document()
will produce a working TOC even if some headers start with number (#2039). -
Fix an issue with
knit_print.data.frame
. The...
arguments are no more passed toprint()
to avoid passingknit_print()
argumentsoptions
andencoding
to customprint()
methods (#2047).
rmarkdown 2.6
-
Encoding is correctly handled now in
html_vignette
when checking for identical title and vignette index entry (thanks, @py-b, #1978). -
clean_site()
now default topreview = TRUE
and will no more remove files without notice. This change will affect the "Clean All" button in the "Build" pane for website project.clean_site(preview = FALSE)
must be run to effectively remove files (#1973). -
The intermediate
.tex
file is now correctly deleted ifkeep_tex = FALSE
when the R Markdown document is not rendered from the working directory (thanks, @vqv, #1308). -
Fix a bug causing certain resources files to be deleted as intermediate files when
intermediates_dir
is the same as the input (thanks, @bellma-lilly, #1248). -
Fix issues with
anchor_sections = TRUE
and learnr (thanks, @gadenbuie, #1938). -
Enable use of
server.R
andglobal.R
alongsideruntime: shinyrmd
documents. -
pkg_file_lua()
now works withdevtools::load_all()
and testthat when used in other packages. -
Fix
pandoc_convert(citeproc = TRUE)
not supressing the--natbib
or--biblatex
options (thanks, @atusy, #1932). -
pandoc-citeproc
is now activated if abibliography
field is defined in another YAML block instead of the first YAML block (thanks, @bwiernik, #1364). -
Specify that
htmltools::htmlPreserve()
should use the pandoc raw attribute
rather than preservation tokens when pandoc >= v2.0. Note that this option will
have the intended effect only for versions of htmltools >= 0.5.0.9003. -
anchor_sections
inhtml_documents()
now defaults toFALSE
. It was introduced in previous version with a default toTRUE
, but it is reverted now after hearing feedbacks from the community (thank you!). The#
is still used as the character for the anchor but you can easily change that using CSS rules. Examples have been added to the help page?html_document
. -
Using Pandoc's default for
--email-obfuscation
now. Previously, it was set tonone
explicitly, which is the default for Pandoc 1.17.2+ anyway. Only users with a Pandoc version before 1.17.2 may see a change in the content of the html source file produced if the document contains email addresses. This change allows to pass the Pandoc's command line flag if you want to set it to another value (thanks,@seankross, #1969).output: html_document: pandoc_args: ["--email-obfuscation", "javascript"]
See Pandoc's manual for the meaning of this option.
rmarkdown 2.5
-
Tables without header rows (wich can be possible in Pandoc's simple table) are now formatted correctly when using
html_document()
format (thanks, @fkohrt, #1893). -
html_document
gains theanchor_sections
argument, which isTRUE
by default, so that readers can get links to section headers easily---when you mouse over a section hader, you will see a hash symbol#
at the end of the header, which contains the anchor link to this header. You can click on this link and get the URL in the addres bar of your web browser, or right-click on it and copy the URL from the context menu. The hash symbol is defined by the CSS rulea.anchor-section::before {content: '#';}
. You can customize it by overriding this rule (e.g., via thecss
argument ofhtml_document
) and use any other symbols or icons, e.g.,content: "\02AD8;"
(thanks, @atusy, #1884). -
pkg_file_lua()
should have thrown an error if the expected Lua file does not exist. -
Provide
files_dir
andintermediates_dir
as attributes on return fromrender()
whenrun_pandoc = FALSE
. -
Supports new Pandoc 2.11
--citeproc
flags usage instead ofpandoc-citeproc
external filter.pandoc_convert()
andpandoc_citeproc_convert()
will now use the correct flags according to the Pandoc version used. The logic is exported inpandoc_citeproc_args()
. See Pandoc release note for more information about the newciteproc
processing (#1916). -
Fixed the code highlighting when code block is hidden. Previous version introduced a regression where non default code highlighting was still shown when
code_folding
is activated and code block is hidden (thanks, @matthewcarlucci, #1921). -
The minimal required version for the xfun package (v0.15) has been specified for R Markdown Notebooks to work properly (thanks, @jmcphers, #1923).
-
Fixed a bug in
convert_ipynb()
when the language is not specified in the.ipynb
file (thanks, @acca3003, #1925). -
Introduce
runtime: shinyrmd
as a more user friendly alias forruntime: shiny_prerendered
.
rmarkdown 2.4
-
Lua filters handling has been improved internally with some user-facing changes (#1899):
- New exported function
pandoc_lua_filter_args()
to return the Pandoc command-line argument to add a Lua filter. - New argument
lua_filters
inpandoc_options()
to pass the Lua filter paths to use with a format. This allow output format authors to add filters for a custom format using thepandoc
argument ofoutput_format()
and to get filters from a format usingfmt$pandoc$lua_filters
. - The Lua filters of an output format are now passed to Pandoc in
render()
. By default, they are passed to Pandoc before any other format-defined or user-defined Pandoc arguments (usually via thepandoc_args
option of an output format). This ensures that filters of an output format are executed first. To change the default, you need to deal with it in a custom format (i.e., modify the elements infmt$pandoc$lua_filters
, such as reordering them). - New exported function
pkg_file_lua()
to get the full system path of a Lua filter included in a package source within theinst/rmarkdown/lua
folder (thanks, @atusy, #1903).
- New exported function
-
Fixed the path separators for the
css
parameter in YAML frontmatter for HTML output files under Windows. Previously, forward slashes incss
paths were converted to backslashes (thanks, @jonathan-g, #1862). -
Since rmarkdown 1.16, Pandoc's fenced
Div
's are converted to LaTeX environments when the output format is LaTeX, e.g.,::: {.center data-latex=""}
is converted to\begin{center}
. The attributedata-latex
of theDiv
was mandatory, even if it is empty. In rmarkdown 2.2, we silently drop this requirement, which means::: {.center}
is converted to\begin{center}
. This turns out to be a bad idea, because users have no control over which Div's to be converted to LaTeX environments. Previously, they could opt-in by thedata-latex
attribute, but with rmarkdown 2.3, all Div's are converted to LaTeX environments unconditionally. What's more, this change led to bugs like https://stackoverflow.com/q/62340425/559676 and rstudio/bookdown#883. Therefore thedata-latex
attribute became mandatory again in this version. If the LaTeX environment does not need arguments, you may usedata-latex=""
. -
The two Lua fitlers
pagebreak.lua
andlatex-div.lua
(introduced in rmarkdown 1.16) are also applied to the output formatbeamer_presentation
now (thanks, @XiangyunHuang, #1815). -
When customizing formats with the
output_format
function,pre_knit
,opts_hooks
, andknit_hooks
can now refer tormarkdown::metadata
. Previously,rmarkdown::metadata
returnedlist()
in these functions (thanks, @atusy, #1855). -
rmarkdown::find_external_resources()
now discovers external template files. This in turn fixes the rendering issue ofhtml_document
with theshiny
runtime andintermediate_dir
set (thanks, @atusy, @cderv, #1865). -
Added the
number_sections
argument to following formats:github_document
,ioslides_presentation
,md_document
,odt_document
,powerpoint_presentation
,rtf_document
,slidy_presentation
,word_document
. These are powered by a Lua filter and requires Pandoc > 2.0. It will silently have no effect has before with previous pandoc version (thanks @atusy 1893). Pandoc >= 2.10.1 adds--number-sections
for docx format, and thusword_document
prefers the native feature to the Lua filter (thanks, @jooyoungseo, #1869). -
For the output format
pdf_document
, the optionfig_crop
will not be enabled unless both the programspdfcrop
andghostscript
are found (thanks, @dalupus, yihui/knitr#954). -
Fixed a bug that a chunk with a class
fold-hide
hides the rest of the chunks even the output format settinghtml_document(code_folding = "show")
(thanks, @atusy, #1906). -
Updated documentation for
render()
to make it clearer how options are set for theoutput_format
parameter (thanks, @jonathan-g, #1907 and rstudio/bookdown#930). -
Ported some CSS styles (e.g., underlines, small caps, and multi-column layouts) from the latest Pandoc's HTML template into rmarkdowns HTML templates (thanks, @atusy, #1878, #1908).
rmarkdown 2.3
-
Addressed an accessibility issue in highlighted code blocks of HTML output for screen reader users: screen readers no longer read out an unnecessary code line id values (thanks, @jooyoungseo and @atusy, #1833).
-
Added
file_scope
option to output format definition. This enables handling of duplicate numeric footnote identifiers (e.g. across bookdown chapters) via the pandoc--file-scope
option (#1837). -
Added the customizable
lang
attribute toioslides_presentation
output (thanks, @jooyoungseo, #1841). -
Added
publish_site()
function for "one-button" publishing of R Markdown websites. -
When the
df_print
option iskable
and the output format is not HTML,<div class="kable-table">
is no longer added to thekable()
output, because recent versions of Pandoc will convert thediv
to a LaTeX environment when the output format is LaTeX (thanks, Laurens, https://stackoverflow.com/q/62340425/559676). -
html_vignette()
only warns against differences in the vignette title and the vignette index entry for R >= 3.6.0 (thanks, @krlmlr, #1832). -
html_document()
can applycode_folding
on any chunk engines if thefoldable
class is added to a source code block via the chunk options (class.source
orattr.source
). You may apply this feature to all the source code blocks, for example, by settingknitr::opts_chunk$set(class.source = "foldable")
at the beginning of your document (thanks, @atusy, #1835).
rmarkdown 2.2
-
Exported the internal function
find_pandoc()
, and also added two arguments,dir
andversion
, so that users can provide a custom directory under which this function may find Pandoc, as well as an expected version of Pandoc to be found (thanks, @connorp, #1785). -
pandoc_metadata_arg()
is a new Pandoc helper function to generate--metadata
argument for Pandoc command line (thanks, @cderv, #1789). -
The output format
html_vignette()
now warns against differences in the vignette title specified in thetitle
field in the YAML metadata and the one specified inside\VignetteIndexEntry{}
. Normally they are expected to be identical (#1789). -
Fixed a bug with encoding when rendering
html_notebook
containing HTML widgets (thanks, @cderv, #1799). -
TOC title can now be specified for
html_document
via the top-level optiontoc-title
in the YAML frontmatter (thanks, @atusy, #1771). -
Floating TOC can now distinguish upper/lower-cases (thanks, @atusy, #1783).
-
When
code_folding='show'
for the output formathtml_document
, code blocks can be individually hidden initially by specifying the chunk optionclass.source='fold-hide'
(thanks, @atusy, #1798). -
For LaTeX/PDF output formats
pdf_document
,beamer_presentation
, andcontext_document
, the argumentcitation_package = 'none'
was deprecated, andcitation_package = 'default'
should be used instead if citations are to be processed bypandoc-citeproc
(thanks, @njbart, rstudio/bookdown#754). -
output_format()
can now inheritkeep_md
andclean_supporting
frombase_format
whenNULL
is passed to these arguments. Previously, you must explicitly specifykeep_md
and/orclean_supporting
asTRUE
orFALSE
inoutput_format()
since they could not inherit the corresponding options ofbase_format
. This behavior was not consisent with other arguments ofoutput_format()
(thanks, @atusy, #1823). -
The
smart
argument of most output formats has been removed, because Pandoc'ssmart
extension is enabled by default, and settingsmart: false
for an output format did not really have any effect (which could be considered a bug, but we want to get rid of this option since it existed only for a historical reason for Pandoc 1.x, and Pandoc 2.x has been released for more than two years). If you want to disable thesmart
extension, you can use the optionmd_extensions: -smart
of the output format (thanks, @atusy, #1774). -
pdf_document()
should not specify thegeometry
variable when thedocumentclass
variable is passed to Pandoc (thanks, @jpcirrus, #1782). -
render()
now respects the YAML metadata in the R script when rendering the script with Pandoc 2.8 or later (thanks, @nsoranzo #1740, @cderv #1741). -
For
pandoc_convert()
, when the argumentto = 'pdf'
, it will be changed to'latex'
internally (thanks, @JohannesFriedrich, #1802). -
render(run_pandoc = FALSE)
no longer cleans up the Markdown file (typically knitted from Rmd) (thanks, @BrianDiggs, #1812).
rmarkdown 2.1
-
Added the returned output from
shiny::runApp()
withinrmarkdown::run()
(thanks, @schloerke, #1760). -
YAML header is now correctly parsed in
html_notebook
's intermediate.knit.md
file so that features like adding bibliography works again (thanks, @everdark, @cderv, #1747). -
ioslides_presentation
template no longer generates an empty<h2>
tag whensubtitle
is not specified in YAML (thanks, @jooyoungseo #1735, @cgrudz #1663). -
No longer center the
#header
element in thehtml_vignette()
output (thanks, @EmilHvitfeldt, #1742). -
Ensure the
tempdir()
exists (viatempdir(TRUE)
) when writing HTML dependencies to a temporary file, because this directory might be erased by accident (thanks, Kurt Hornik, and also @karawoo #1743). -
Added the
slide_level
argument toslidy_presentation()
(https://stackoverflow.com/q/59157211/559676). -
Removed the jQuery dependency in
html_document_base()
(#1723). To avoid bugs like #1723, Pandoc 2.8 users have to upgrade to Pandoc 2.9+. -
For
pdf_document
, horizontal rules generated by Pandoc (before v2.8) stopped working in recent versions of TeX Live, and the same fix as the one to jgm/pandoc#5801 (i.e., hard-code\linethickness
to0.5pt
) was applied in rmarkdown (thanks, @cderv, https://stackoverflow.com/a/58646915/559676).
rmarkdown 2.0
-
For the output format
pdf_document()
, we no longer adjust the vertical spacing of the title area. This means there will be a larger spacing above the document title in PDF. If you prefers the old (smaller) spacing, please download https://github.com/rstudio/rmarkdown/blob/f6961af/inst/rmd/latex/compact-title.tex and include it to the preamble via theincludes
option ofpdf_document
. However, please note that this means you won't be able to have multiple authors in theauthor
field of the YAML frontmatter, unless you use a custom LaTeX template. With the default LaTeX template, you will run into the error in #1716. Besides, thecompact-title
option in YAML is no longer supported. -
R code in the
header-includes
field in the YAML frontmatter stopped working in the previous version of rmarkdown. The code should be evaluated before passing to Pandoc (thanks, @mcol #1709, @cderv #1710). -
The
encoding
argument is no longer passed to theintermediates_generator
of R Markdown output formats. Theintermediates_generator
function can only accept argumentsinput_file
andintermediates_dir
now (see?rmarkdown::output_format
). This is a breaking change to developers. If you are an output format developer, you have to remove theencoding
argument in yourintermediates_generator
if your output format uses this function. -
The
encoding
argument is no longer passed to therender
element of the site generator (see?rmarkdown::render_site
). -
The
encoding
argument has been removed from many of the internal functions in the rmarkdown package. Now all input files are assumed to be encoded in UTF-8. If you see an error message like "Error inFUN(arg = ...)
: unused argument (arg = ...
)", please file an issue (with a reproducible example) to https://github.com/rstudio/rmarkdown. -
Added a new output format
context_document()
to support ConTeXT output (thanks, @RLesur #1725, @jooyoungseo #1713). -
render_site()
can render R scripts in addition to Rmd files if you setautospin: true
in_site.yml
(thanks, @zeehio, #1564). -
Added
ext
argument tomd_document()
. Its default value is ".md". This argument is intended to be used together withvariant
argument (e.g.,variant = "context"
andext = ".pdf"
) (thanks, @atusy, #1715). -
ioslides_presentation()
stylesheet is updated for printing. Browsers are notified that the presentation should preferentially be printed in landscape orientation and without margin (thanks, @RLesur, #1718). -
Reverted the fix #1703 and applied an alternative fix to #1700, because the original fix brought a new bug #1714 (thanks, @pablobernabeu @cderv @everron @aronatkins).
-
Tabsets don't work with Pandoc 2.8 (thanks, @mnazarov, #1723).
-
The
pdf_document
format failed to work if theheader-includes
field in YAML is an empty list (thanks, @cderv, #1728).