Reprex of qmd file:

`````
---
title: "reprex"
format: html
---
```{r}
myfun <- function() print("helloworld")
```
This doesn't work:
```{r}
#| fig-cap: !expr 'myfun()'
hist(rnorm(1000))
```
`````

Following error on Windows 10 rendering from Rstudio & the quarto vscode extension:
```
processing file: quarto_reprex.qmd
Error in myfun() : could not find function "myfun"
Error in yaml::yaml.load(yaml, eval.expr = TRUE) : 
  Could not evaluate expression: myfun()
Calls: .main ... parse_block -> partition_yaml_options -> <Anonymous>
Execution halted
```
Quarto version: 1.2.335
Rstudio version: 2022.07.2 Build 576
R version: 4.0.4 (2021-02-15) -- "Lost Library Book"

2023-03-07T22:05:26Z
mrajeev08
v1.3
closed
Issue with !expr in fig-cap not finding object in global environment in R
https://github.com/quarto-dev/quarto-cli/issues/4711