Reputation: 139
Given with this
```{r}
stringr::str_view(c("alice", "bob"), "o")
```
I get an error:
Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: yes
Note however that the HTML output will not be visible in non-HTML formats.
Why is bookdown complaining about this? It seems that stringr::str_view
is being executed unnecessarily.
EDIT: The desired result is a PDF with the stringr::str_view(c("alice", "bob"), "o")
text and syntax highlighting.
Upvotes: 1
Views: 288
Reputation: 30124
See Section 2.10 on HTMl Widgets in the bookdown book at https://bookdown.org/yihui/bookdown/html-widgets.html. Basically you need to install the webshot package and PhantomJS.
If you have enabled caching (via the chunk option cache=TRUE
, e.g., https://github.com/rstudio/bookdown/issues/578), you have to remove cache files and rebuild the book.
Upvotes: 1