### Bug description

Using Quarto 1.3.340 on macOS.

Using a Quarto document containing an HTML list with an embedded div:

````markdown
---
title: lists
---

<ul>
  <li>
    <a href="https://posit.co/">
      <div>
        hi
      </div>
    </a>
  </li>
</ul>
````

When rendered, this produces a partial code fragment:

<img width="346" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/362187/5e5f6536-9401-4b03-9604-dbe780657448">

This looks to be partially related to incorrectly seeing the HTML as having inline code and partially related to some JS getting inserted into the middle of the generated HTML.

Rendering to Markdown, it feels like the problem is because we are identifying only part of the document as containing an HTML chunk:

```bash
quarto render index.qmd --to markdown -o index.md
```

````markdown
```{=html}
<ul>
```
```{=html}
<li>
```
`<a href="https://posit.co/">`{=html}
```{=html}
<div>
```
        hi
      </div>
    </a>

```{=html}
</li>
```
```{=html}
</ul>
```
````

Workaround: Avoid indenting HTML code. If all leading whitespace is removed


```
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.340
      Path: /Applications/RStudio.app/Contents/Resources/app/quarto/bin

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

[✓] Checking Python 3 installation....OK
      Version: 3.9.6
      Path: /Library/Developer/CommandLineTools/usr/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 3.6.3
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/3.6/Resources/library
      knitr: 1.42.8
      rmarkdown: 2.20

[✓] Checking Knitr engine render......OK
```


### 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?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
- [X] Please provide the output of `quarto check` so we know which version of quarto and its dependencies you're running.
2023-05-22T21:02:01Z
aronatkins
closed
HTML ul/li elements with embedded div styled as broken code fragment
https://github.com/quarto-dev/quarto-cli/issues/5631