-
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).