### Bug description

Truly bizzare bug. When you include a mermaid.js diagram on the 1st or second slide of a revealjs presentation it displays fine, but when it's on the 3rd slide or later it  requires a refresh to render the diagram.  

OS: Mac OS Big Sur 11.6
Rstudio: 2022.07.1 Build 554


This doesn't work properly:
```md
## Slide 1

## Slide 2

## Mermaid slide

This diagram doesn't show up unless you refresh

```{mermaid}
%%| fig-width: 10
flowchart LR
  A[Write code] --> B(Source Code)
  B --> C{Execute code}
  C --> D[Output]
  C --> E[Output] 
  C --> F[Output]
```
```

But this does: 

```md
## Slide 1

## Slide 2

## Mermaid slide

This diagram doesn't show up unless you refresh

```{mermaid}
%%| fig-width: 10
flowchart LR
  A[Write code] --> B(Source Code)
  B --> C{Execute code}
  C --> D[Output]
  C --> E[Output] 
  C --> F[Output]
```
```

### 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.
- [X] 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.
2022-09-29T16:41:58Z
GShotwell
bug
closed
Mermaid diagrams require refresh when they're on the 3rd (!!) slide of a reveal JS presentation
https://github.com/quarto-dev/quarto-cli/issues/2667