For what it's worth I've found RStudio to be _currently_ inconsistent with chunk label prefixes as shown in the following ASCII encoded MWEs. I don't have chromium or tinytex installed on `quarto tools check`.  Hopefully this is going to be fixed soon.

````markdown
---
title: "MWE 1"
format: html
---

### Environment

-   R Version 4.2.1
-   RStudio desktop 2022.12.0.353"
-   Linux 22.10 (Kinetic Kudu)

### Output

Cross referencing works for @fig-ans and @fig-dag and both labels are picked up by the visual editor crossref widget.

```{r}
#| label: fig-ans
#| fig-cap: First caption
#| echo: false
with(anscombe, plot(x2,y2))
```

------------------------------------------------------------------------

```{dot}
//| label: fig-dag
//| fig-cap: Second caption
digraph ER{
  cause -> effect
}
```
`````

````markdown
---
title: "MWE 2"
format: html
---

### Environment

-   R Version 4.2.1
-   RStudio desktop 2022.12.0.353"
-   Linux 22.10 (Kinetic Kudu)

### Output

This compiles with the cross reference working for @fig-ans. The second chunk label is picked up by the visual editor crossref widget but the crossref fails with @fig-dag and no caption is generated.

```{r}
#| label: fig-ans
#| fig-cap: First caption
#| echo: false
with(anscombe, plot(x2,y2))
```

------------------------------------------------------------------------

```{dot}
#| label: fig-dag
#| fig-cap: Second caption
digraph ER{cause -> effect}
```
`````
````markdown
---
title: "MWE 3"
format: html
---

### Environment

-   R Version 4.2.1
-   RStudio desktop 2022.12.0.353"
-   Linux 22.10 (Kinetic Kudu)

### Output

This fails to compile with

-   unexpected token '/'

-   unexpected token '/'

-   unexpected token '\|'

```{r}
//| label: fig-ans
//| fig-cap: First caption
//| echo: false
with(anscombe, plot(x2,y2))
```

------------------------------------------------------------------------

```{dot}
//| label: fig-dag
//| fig-cap: Second caption
digraph ER{
  cause -> effect
}
```

````

_Originally posted by @ar0berts in https://github.com/quarto-dev/quarto-cli/issues/1296#issuecomment-1425329710_
            
2023-02-10T09:39:26Z
cderv
closed
dot diagram inconsistency with chunk label prefixes
https://github.com/quarto-dev/quarto-cli/issues/4308