Skip to content

Commit f3cd2b8

Browse files
authored
Merge pull request #1717 from quarto-dev/faq/rmarkdown/expr
Add a FAQ point regarding `!expr` and `!r`
2 parents 1715f6e + e829ce2 commit f3cd2b8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/faq/rmarkdown.qmd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,14 @@ You can download the latest release of RStudio from <https://posit.co/download/r
9999
### Does Posit Connect support Quarto?
100100

101101
Yes! You can publish Quarto content to Posit Connect v2021.08.0 or later. Quarto has to be enabled as documented in the Posit Connect [admin guide](https://docs.rstudio.com/connect/admin/appendix/configuration/#Quarto). Connect's user [documentation](https://docs.rstudio.com/connect/user/quarto/) refers to [Quarto.org docs](/docs/publishing/rstudio-connect.qmd#rstudio-ide) on how to publish from the RStudio IDE. To publish Python-based Quarto content, you can use the [rsconnect-python CLI](https://docs.rstudio.com/rsconnect-python/) from various locations, including VSCode, JupyterLab or the terminal.
102+
103+
### Can I use `!expr` or `!r` syntax in YAML options and headers like I do in R Markdown?
104+
105+
It depends on where you use them:
106+
107+
- Inside knitr cells for options using YAML syntax: Yes, `!expr` can be used as [documented](/docs/computations/r.qmd#chunk-options). However, `!r` cannot be used because it will fail Quarto's YAML validation.
108+
- Inside YAML blocks for Quarto document or project configurations: No, neither `!expr` nor `!r` is supported.
109+
110+
Quarto differs from R Markdown because it doesn't rely entirely on R for YAML processing. `!expr` is handled by the **yaml** R package, while `!r` is handled by **knitr** via `xfun::yaml_load()`. These are specific to R's YAML parsing and are not supported in Quarto's YAML metadata blocks. However, when using `engine: knitr` (the default for documents with R cells), YAML options inside knitr cells are parsed by **knitr**, allowing the use of `!expr`.
111+
112+
Lastly, note that Quarto's YAML validation supports `!expr` but not `!r`. If you're a `!r` user, switch to `!expr` for compatibility.

0 commit comments

Comments
 (0)