### Bug description

Adding a label to a chunk will create an empty figure caption when `fig-cap` is undefined (this happens with the knitr-style syntax for chunk labels too). Figure captions should only appear if you opt into them with `fig-cap`, so this feels like a bug.

Here's a reprex:

````qmd
---
title: "Reprex"
format: html
---

```{r}
#| label: fig-cars
plot(cars)
```
````

![Screen Shot 2023-01-06 at 2 56 57 PM](https://user-images.githubusercontent.com/51542091/211113679-26e678d6-3d6e-45fc-99f3-7a0d72828516.png)


### 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?
- [ ] Please document the operating system you're running. If on Linux, please provide the specific distribution.
2023-01-06T23:07:02Z
mccarthy-m-g
bug
closed
Chunk labels create empty figure captions when `fig-cap` is undefined
https://github.com/quarto-dev/quarto-cli/issues/3878