knitr 1.40
NEW FEATURES
-
Added a function
convert_chunk_header()
to convert the old in-header chunk options to the new in-body chunk options (#2149 #2151). -
Added a new "graphics device",
dev = "gridSVG"
, which usesgridSVG::grid.export()
to export grid graphics to SVG (thanks, @jooyoungseo, #2152). -
Added a new engine
eviews
, which calls the EviewsR package to execute EViews code (thanks, @sagirumati, #2158). -
Added support for a
php
engine like other engines for interpreted languages. It will callphp -r <code>
, with<code>
being the chunk content (thanks, @ralmond, #2144). -
Per suggestion of @jakubkaczor (#2116) and discussion with @pedropark99 (#2140), the chunk option
fig.sep
can also be used to add LaTeX code before the first sub-figure now. Previously this option can only be used for adding LaTeX code after each sub-figure. -
knitr::kable()
supportstabularx
andxltabular
environments now for LaTeX tables, e.g.,knitr::kable(head(iris), format = 'latex', tabular = 'tabularx')
(thanks, @amarakon, #2138). -
For HTML output formats of R Markdown, SVG plots (e.g., in case of chunk option
dev = 'svg'
ordev = 'gridSVG'
) can be embedded differently now whenoptions(knitr.svg.object = TRUE)
: if the HTML output is self-contained, the raw SVG code will be embedded directly in HTML, otherwise the.svg
file is embedded in the<object>
tag. By default, this feature is not enabled, i.e., the default isoptions(knitr.svg.object = FALSE)
for backward-compatibility, which means the<img>
tag is used for SVG plots just like other plot formats. This new feature will make assistive technology agents, such as screen readers, interact with SVG plots (thanks, @jooyoungseo, #2152).
BUG FIXES
-
Fixed
epub2
output not being considered as HTML format (thanks, @flipacholas, #2145). -
kable(format = 'pipe')
calculates column widths correctly now if any text columns contain Markdown hyperlinks (thanks, @jacobbien, #2148). -
dev.args = list(engine = ...)
was ignored bydev = 'tikz'
when the tikz plot is compiled to PDF (thanks, @fkohrt, #2150).
MINOR CHANGES
-
When the inline R code cannot be correctly parsed, the error message will show the original code in addition to the parsing error, which can make it easier to identify the code error in the source document (thanks, @AlbertLei, #2141).
-
The internal function
knitr:::wrap()
has been removed from this package. If you rely on this function, you will have to use the exported functionknitr::sew()
instead. -
Duplicate chunk label error will now be thrown with code chunks using
code
orfile
chunk options (thanks, @mine-cetinkaya-rundel, #2126). -
Simplified R Markdown's inline code parser (thanks, @atusy, #2143).