### Bug description

Related to #multiple ch

The main TOC seems to use the first line starting with `#` without rendering it.

A file that starts with a chunk with a comment gets the comment as title in the TOC.
The example below yield a TOC containing `setup` instead of `Chapter title`

``` 
    ```{r}
    # setup
    library(tidyverse)
    ```
    # Chapter title   
```

Inline code is displayed as-is in the TOC.
The example below yields `r my_var` in the TOC instead of the content of TOC.
This is something I use often in bookdown with `knitr_child()` or `knitr_expand()`.

```
    # `r my_var`
```

```
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.1 (2022-06-23)
 os       Ubuntu 20.04.4 LTS
 system   x86_64, linux-gnu
 ui       RStudio
 language nl_BE:nl
 collate  nl_BE.UTF-8
 ctype    nl_BE.UTF-8
 tz       Europe/Brussels
 date     2022-08-18
 rstudio  2022.07.1+554 Spotted Wakerobin (desktop)
 pandoc   2.18 @ /usr/lib/rstudio/bin/quarto/bin/tools/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 bookdown      0.27    2022-06-14 [1] CRAN (R 4.2.0)
 cli           3.3.0   2022-04-25 [1] CRAN (R 4.2.0)
 digest        0.6.29  2021-12-01 [1] CRAN (R 4.2.0)
 evaluate      0.15    2022-02-18 [1] CRAN (R 4.2.0)
 fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.2.0)
 fortunes      1.5-4   2016-12-29 [1] CRAN (R 4.2.0)
 htmltools     0.5.2   2021-08-25 [1] CRAN (R 4.2.0)
 knitr         1.39    2022-04-26 [1] CRAN (R 4.2.0)
 lipsum        0.1.0   2022-05-04 [1] https://inbo.r-universe.dev (R 4.2.0)
 rlang         1.0.3   2022-06-27 [1] CRAN (R 4.2.1)
 rmarkdown     2.14.1  2022-05-04 [1] https://thierryo.r-universe.dev (R 4.2.0)
 rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.2.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.2.0)
 xfun          0.31    2022-05-10 [1] CRAN (R 4.2.0)

 [1] /home/thierry/R/x86_64-pc-linux-gnu-library/4.0
 [2] /usr/local/lib/R/site-library
 [3] /usr/lib/R/site-library
 [4] /usr/lib/R/library
```

### `quarto check` Output

```bash
[✓] Checking Quarto installation......OK
      Version: 0.9.655
      Path: /opt/quarto/bin

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

[✓] Checking Python 3 installation....OK
      Version: 3.8.10
      Path: /usr/bin/python3
      Jupyter: 4.6.3
      Kernels: python3

(/) Checking Jupyter engine render....Traceback (most recent call last):
  File "/opt/quarto/share/jupyter/jupyter.py", line 21, in <module>
    from notebook import notebook_execute, RestartKernel
  File "/opt/quarto/share/jupyter/notebook.py", line 17, in <module>
    from nbclient import NotebookClient
ModuleNotFoundError: No module named 'nbclient'
[✓] Checking Jupyter engine render....OK
```

### `quarto tools check` Output

```bash
[✓] Inspecting tools
ERROR: TypeError: Specifier not found in cache: "https://deno.land/x/cache@0.2.12/directories.ts", --cached-only is specified.
    at file:///opt/quarto/bin/vendor/deno-land/x/puppeteer@9-0-2/vendor/puppeteer-core/vendor/cache.ts:1:26
```

### 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, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] documented the quarto version you're running, by pasting the output from running `quarto check` in the "Quarto Check Output" text area?
- [X] documented the version of the quarto tools you're running, by providing the output from running `quarto tools check` in the "Quarto Tools Check Output" text area?
- [X] documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] documented which operating system you're running? If on Linux, please provide the specific distribution as well.
- [X] upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?
cscheid
2022-08-18T14:12:40Z
ThierryO
bug ast
v1.4
open
rendering main HTML TOC for books
https://github.com/quarto-dev/quarto-cli/issues/1966