## Checklist

- [x] [formatted your issue](https://yihui.org/issue/#please-format-your-issue-correctly) so it is easier for us to read?

- [x] included a minimal, self-contained, and reproducible example?

- [x] documented the quarto version you're running, by providing the output produced by `quarto check` in a terminal in your issue?

```
$ quarto check

[✓] Checking Quarto installation......OK
      Version: 99.9.9
      Path: /Users/david/quarto-cli/package/dist/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....(None)

      Unable to locate an installed version of Python 3.
      Install Python 3 from https://www.python.org/downloads/

[✓] Checking R installation...........OK
      Version: 4.2.0
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.2/Resources/library
      rmarkdown: 2.14

[✓] Checking Knitr engine render......OK
```
- [x ] documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?

`RStudio 2022.02.3+492 "Prairie Trillium" Release (1db809b8323ba0a87c148d16eb84efe39a8e7785, 2022-05-16) for macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36`

- [x ] documented which operating system you're running? If on Linux, please provide the specific distribution as well.

MacOS Big Sur

- [x ] upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?

Using Quarto from github master.

## Bug

The example below uses `knitr::asis_output()` to write an HTML table. This is meant to simulate an R table package doing the same thing. It works fine, and captions and labels are injected by quarto.

If I also use `htmltools::htmlPreserve()`, then the table is still shown, but captions are not shown and labels do not resolve.

````

---
title: "Untitled"
format: html
---

# Without htmlPreserve

Reference to @tbl-label.

```{r}
#| tbl-cap: "My caption without htmlPreserve"
#| label: tbl-label

knitr::asis_output("<table><tr><td>A table</td></tr></table>")

```

# With htmlPreserve

Reference to @tbl-label-preserve.

```{r}
#| tbl-cap: "My caption with htmlPreserve"
#| label: tbl-label-preserve

knitr::asis_output(htmltools::htmlPreserve("<table><tr><td>A table</td></tr></table>"))

```
````
2022-06-05T17:52:33Z
hughjonesd
closed
htmlPreserve breaks quarto captions and labels
https://github.com/quarto-dev/quarto-cli/issues/1069