### Bug description

Given the following Quarto document:

````markdown
---
title: "test"
---

```{r}
w <- reactable::reactable(iris)

htmlwidgets::saveWidget(
  widget = w, 
  file = "test.html",
  selfcontained = TRUE
)

htmltools::includeHTML("test.html")
```
````

When this document is rendered from a terminal (outside RStudio), the R code fails to find Pandoc, producing the error:

```
Quitting from lines 8-18 (index.qmd)
Error in htmlwidgets::saveWidget(widget = w, file = "test.html", selfcontained = TRUE) :
  Saving a widget with selfcontained = TRUE requires pandoc. For details see:
https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md
Calls: .main ... eval_with_user_handlers -> eval -> eval -> <Anonymous>

Execution halted
```

This problem can be avoided by setting `RSTUDIO_PANDOC` to the path to the Pandoc executable included with Quarto:

```bash
RSTUDIO_PANDOC=$QUARTO_ROOT/bin/tools quarto render index.qmd
```

Quarto should set `RSTUDIO_PANDOC` and possibly add its managed Quarto to the PATH.

Using Quarto 1.2.269 on macOS Monterey (12.6.1) and Linux (various versions).

### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [ ] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [x] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cscheid
2022-12-16T14:40:21Z
aronatkins
bug
v1.3
closed
Help R code discover Pandoc
https://github.com/quarto-dev/quarto-cli/issues/3688