-
Notifications
You must be signed in to change notification settings - Fork 363
Description
Bug description
When rendering to pdf, neither using ::: {.content-visible when-format="html"}
nor using the chunk options include=knitr::is_html_output()
and echo = false
avoids an error about the fact that the code chunk, if rendered, would produce html output.
Steps to reproduce
Here is an example where the code block uses the vembedr package. Rendering the quarto document
---
title: "test"
format: pdf
---
Hello world
::: {.content-visible when-format="html"}
```{r, include=knitr::is_html_output()}
#| echo: false
vembedr::embed_url("https://youtu.be/_AeywguOA0o")
```
:::
Expected behavior
The code block should be ignored for the pdf output
Actual behavior
An error:
==> quarto preview test.qmd --to pdf --no-watch-inputs --no-browse
processing file: test.qmd
output file: test.knit.md
Error: Functions that produce HTML output found in document targeting pdf output.
Please change the output type of this document to HTML.
If you're 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, and configure it by looking at its documentation.
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.
Execution halted
Your environment
- IDE RStudio RStudio 2024.12.0+467
- Linux Mint 22
Quarto check output
Quarto 1.6.39
[✓] Checking environment information...
Quarto cache location: /home/gustav/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.4.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.46.3: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.6.39
Path: /opt/quarto/bin
[✓] Checking tools....................OK
TinyTeX: v2024.12
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /home/gustav/.TinyTeX/bin/x86_64-linux
Version: 2024
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.12.3
Path: /usr/bin/python3
Jupyter: (None)
Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter
[✓] Checking R installation...........OK
Version: 4.4.2
Path: /usr/lib/R
LibPaths:
- /home/gustav/R/x86_64-pc-linux-gnu-library/4.4
- /usr/local/lib/R/site-library
- /usr/lib/R/site-library
- /usr/lib/R/library
knitr: 1.49
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK