### Bug description

```
Quitting from lines 101-107 [XYZ] (xyz.qmd)
Error in `add_html_caption()`:
! unbenutztes Argument (xfun::grep_sub("^[^<]*<[^>]+aria-labelledby[ ]*=[ ]*\"([^\"]+)\".*$", "\\1", x))
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
     ...
 14. sew(res, options)
 15. knitr:::sew.list(x, options, ...)
 16. base::lapply(x, sew, options, ...)
 17. FUN(X[[i]], ...)
 18. knitr:::sew.knit_asis(x, options, ...)
Ausführung angehalten
Fehler in close_connection() : 
  konnte Funktion "close_connection" nicht finden
Ruft auf: <Anonymous> -> <Anonymous>
```

### Steps to reproduce

I got a simple html document with knnitr engine (under R). There is this code block that does not render:


```
{r}
#| label:  "XYZ"
#| include: true
#| echo: true

library(plotly)
plot_ly(economics, x = ~pop)
```

### Expected behavior

Should render properly.

### Actual behavior

_No response_

### Your environment

```
R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so;  LAPACK version 3.8.0

locale:
 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C               LC_TIME=de_DE.UTF-8        LC_COLLATE=de_DE.UTF-8     LC_MONETARY=de_DE.UTF-8   
 [6] LC_MESSAGES=de_DE.UTF-8    LC_PAPER=de_DE.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Berlin
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
 [1] vctrs_0.6.2       knitr_1.43        httr_1.4.6        cli_3.6.1         xfun_0.39         rlang_1.1.1       purrr_1.0.1      
 [8] renv_0.17.3       generics_0.1.3    jsonlite_1.8.5    data.table_1.14.8 glue_1.6.2        colorspace_2.1-0  htmltools_0.5.5  
[15] scales_1.2.1      fansi_1.0.4       grid_4.3.0        munsell_0.5.0     tibble_3.2.1      fastmap_1.1.1     yaml_2.3.7       
[22] lifecycle_1.0.3   compiler_4.3.0    dplyr_1.1.2       htmlwidgets_1.6.2 pkgconfig_2.0.3   tidyr_1.3.0       rstudioapi_0.14  
[29] plotly_4.10.2     digest_0.6.31     viridisLite_0.4.2 R6_2.5.1          tidyselect_1.2.0  utf8_1.2.3        pillar_1.9.0     
[36] magrittr_2.0.3    tools_4.3.0       gtable_0.3.3      lazyeval_0.2.2    ggplot2_3.4.2   
```

### Quarto check output

_No response_
mcanouil
2023-06-15T06:09:59Z
Patrikios
duplicate
closed
simple plotly output not rendering for HTML output
https://github.com/quarto-dev/quarto-cli/issues/5936