In the past, the html output from str_view()
could be properly rendered in pdf slides, given that the webshot
package was installed (see also this answer). However, this no longer works.
The following Rmd file should produce a title slide and a slide showing a regex example:
---
title: "Regex"
output: beamer_presentation
---
```{r setup, include=FALSE}
library(stringr)
```
## `str_view`
```{r regex1}
str_view(c("abc", "bcd", "cde"), "bc", html = TRUE)
```
If only the webshot
package, but not webshot2
, is installed, I get the following error on knitting:
Error:
! webshot.js returned failure value: 1
Backtrace:
1. rmarkdown::render(...)
2. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
3. knitr:::process_file(text, output)
7. knitr:::process_group.block(group)
8. knitr:::call_block(x)
...
19. knitr (local) value_fun(ev$value, ev$visible)
20. knitr (local) fun(x, options = options)
22. knitr::knit_print(x, ...)
23. knitr:::html_screenshot(x)
26. webshot (local) `<fn>`(...)
Execution halted
Calling webshot::is_phantomjs_installed()
returns TRUE
, so PhantomJS is installed.
If I install webshot2
, knitting works without error, but the html-output of str_view()
is not shown:
The expected output that could be created in the past would look something like this (recreated with an image manipulation program):
What is the problem here? And is there still a way to get this to work?
(I am aware that I could use the text output from str_view()
without html = TRUE
, but I would prefer the html output.)
I am running this on Ubuntu 22.04.2 using the following versions:
- R 4.3.1
- Pandoc 3.1.1 (the version that comes with RStudio)
- webshot 0.5.5
- webshot2 0.1.0
- rmarkdown 2.23
- knitr 1.43
- stringr 1.5.0