Skip to content

knitr 1.51

Latest

Choose a tag to compare

@yihui yihui released this 20 Dec 16:38
· 1 commit to master since this release

NEW FEATURES

  • Added support for OpenTelemetry observability. When the otel and otelsdk packages are installed and tracing is enabled, spans are automatically created for all knit operations. See otelsdk's Collecting Telemetry Data for more details on configuring OpenTelemetry (thanks, @shikokuchuo, #2422).

    • knit() produces 'knitr processing' and 'knitr output' spans when starting and finishing an operation
    • knit() produces 'knit' spans for each chunk, recording attributes such as the label and knit engine
  • Added support for hooks that get executed before and after knitting (thanks, @cderv #2223, @arnaudgallou #2419). To register a hook before knitting starts, use knitr::knit_hooks$set(before.knit = function() {}). Similarly, the hook after.knit can be registered and will be executed after knitting is finished.

BUG FIXES

  • Fix issue with error traceback not correctly showing when rlang is available.

  • Improve error traceback when rlang is available and evaluate > 1.0.3 is used (thanks, @cderv, #2388).

  • For Quarto, chunk options written in pipe comments must use the comment character of the chunk's language (#2225). Previously, comments written in #| will be parsed even if # is not the comment character of the chunk.

  • hook_optipng() now uses the -quiet argument of optipng to suppress the messages by default.

  • Don't set vheight or vwidth for webshot2::webshot() when the chunk option out.height or out.width is a percentage (%). Setting screenshot.opts chunk option is still a way to specify vheight or vwidth specifically for webshot(), e.g., screenshot.opts = list(vwidth = 6 * 72, vheight = 6 * 72 * 0.618) for the width of 6 inches size with 72 dpi and 0.618 of aspect ratio.

  • HTML screenshots are taken inside the current working directory by default if it is writable, instead of tempdir(), which may not be accessible to certain browsers (thanks, @markschl, #2416). The directory can be customized via the global R option knitr.html_screenshot.tmpdir, e.g., if you want the old behavior, you may set options(knitr.html_screenshot.tmpdir = tempdir()).

MINOR CHANGES

  • Empty alt text for images is allowed now (thanks, @Olivia-Box-Power, #2415). With the chunk option fig.alt = '', the HTML output will be <img alt = "" ... />. Previously, the alt attribute was omitted in this case. If you still want to omit the alt attribute, you may use fig.alt = NA.