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 operationknit()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 hookafter.knitcan 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-quietargument ofoptipngto suppress the messages by default. -
Don't set
vheightorvwidthforwebshot2::webshot()when the chunk optionout.heightorout.widthis a percentage (%). Settingscreenshot.optschunk option is still a way to specifyvheightorvwidthspecifically forwebshot(), 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 optionknitr.html_screenshot.tmpdir, e.g., if you want the old behavior, you may setoptions(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, thealtattribute was omitted in this case. If you still want to omit thealtattribute, you may usefig.alt = NA.