quarto-dev / quarto-dev/quarto-cli
Clarify message about `prefer-html` when HTML content is produced in non-HTML output
@cderv is already working on this.
Since Feb 13, 2024.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
I'm writing a document that includes a kableExtra table, which is a HTML document. When rendering the document to .docx, I get the usual warning:
Error: Functions that produce HTML output found in document targeting docx output.
Please change the output type of this document to HTML.
If your aiming to have some HTML widgets shown in non-HTML format as a screenshot,
please install webshot or webshot2 R package for knitr to do the screenshot.
Alternatively, you can allow HTML output in non-HTML formats
by adding this option to the YAML front-matter of
your quarto file:
prefer-html: true
Note however that the HTML output will not be visible in non-HTML formats.
However, I have both webshot and webshot2 installed, along with PhantomJS and a chrome browser. knitr:::webshot_available() returns:
webshot2 webshot
TRUE TRUE
And furthermore, when I render the same file to PDF, it works with no issues. I believe the same warning should have appeared in this case too, if it was really about the webshot libraries.
Steps to reproduce
---
title: My new document
format:
docx: default
---
```{r}
library(dplyr)
library(knitr)
library(kableExtra)
kable(mtcars) %>% kableExtra::kable_classic_2()
```
Expected behavior
The file should be rendered to .docx sucessfully, with an image of the mtcars table.
Actual behavior
Rendering fails even though webshot and webshot2 are installed. Also, the render works for .pdf files.
Your environment
IDE: RStudio 2023.09.1, OS: Windows 11.
The issue persists when using CLI Quarto, so it shouldn't be related to RStudio!
Quarto check output
Quarto 1.4.549
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.4.549
Path: C:\Users\Administrator\AppData\Local\Programs\Quarto\bin
CodePage: 1250
[>] Checking tools....................OK
TinyTeX: v2024.02
Chromium: 869685
[>] Checking LaTeX....................OK
Using: TinyTex
Path: C:\Users\Administrator\AppData\Roaming\TinyTeX\bin\windows
Version: 2023
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........OK
Version: 4.2.2
Path: C:/PROGRA1/R/R-421.2
LibPaths:
- C:/RPackages
- C:/Program Files/R/R-4.2.2/library
knitr: 1.45
rmarkdown: 2.22
[>] Checking Knitr engine render......OK
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.