Skip to content

CRAN release v1.21

Compare
Choose a tag to compare
@yihui yihui released this 10 Dec 22:58
· 821 commits to master since this release

NEW FEATURES

  • Added styler support: the chunk option tidy = 'styler', the code will be reformatted using the styler package. The chunk option tidy = TRUE means tidy = 'formatR' and still uses formatR::tidy_source() to reformat the code. The chunk option tidy can also take a custom function to reformat the code. See the documentation for details: https://yihui.name/knitr/options/ (thanks, @lorenzwalthert, #1581).

  • Added a new hook function hook_gifski() to create a GIF animation from plots in a code chunk. To enable this hook, you may install.packages('gifski') and set the chunk option animation.hook='gifski'. See https://yihui.name/en/2018/08/gifski-knitr/ for examples.

  • Added a new object cache_engines for other language engines to handle caching. See ?knitr::cache_engines for details (thanks, @tmastny, #1518).

  • Can now pass additional arguments to knitr vignette engines if needed (thanks, @jimhester, #1577).

  • When options(knitr.include_graphics.ext = TRUE) is set, the full filename will be used in \includegraphics{} (e.g., \includegraphics{foo.pdf}) instead of the (default) base filename (e.g., \includegraphics{foo}) if a plot is embedded in the LaTeX output. This will avoid the ambiguity for LaTeX to choose the correct file (#1587).

  • The chunk option engine.opts can also take a list now, so that users can specify different options for different language engines (thanks, @kiwiroy, #1632).

  • Added functions raw_block(), raw_latex(), and raw_html() to wrap content in raw attribute blocks for Pandoc (thanks, @hughjonesd, #1633).

BUG FIXES

  • valign in kable_latex() does not put the float alignment to the correct location (thanks, @haozhu233, #1487, #1519).

  • engine.path does not work for engine = 'dot' (thanks, @billy34, #1534).

  • The sql engine now caches the result properly when the chunk option output.var is specified (thanks, @yutannihilation, #1544).

  • knit_params() mangles UTF-8 text not representable in current locale (thanks, @kevinushey, #1557).

  • The linesep argument in kable(format = 'latex') does not work as expected (thanks, @tinu-schneider, #1558).

  • MP4 generated by hook_ffmpeg() does not work in Safari (thanks, @brianzhang01, #1586).

  • The chunk option fig.env does not work for PDF output from R Markdown (thanks, @RSchwinn, #1620).

  • spin() fails to generate a proper R Markdown document when the R script contains roxygen comments as string literals or more than three backticks (thanks, @yutannihilation, #1605, #1611).

  • Stan chunks cannot be properly cached: the bug #1064 appeared again (thanks, Mark, https://stackoverflow.com/q/53660143/559676).

  • Roman numerals should not be converted to arabic numerals in inline R expressions (thanks, @rgaiacs, #1625).

MAJOR CHANGES

  • For R scripts passed to spin(), only the UTF-8 encoding is accepted (previously it assumes the native encoding of the system).

  • Due to changes in the S3 method dispatch mechanism since R 3.5.0, you will have to call registerS3method() to register knit_print methods defined in code chunks. For package authors, it no longer suffices to export a method without importing knitr::knit_print, but if you don't want to import it, there is still a workaround. See the package vignette vignette('knit_print', package = 'knitr') for details (thanks, @wch @kevinushey @skranz #1580).

MINOR CHANGES

  • spin() will close each individual code chunk if multiple code chunks appear consecutively (previously it only closes the last code chunk in this case) (thanks, @avehtari, #1590).