## Steps to recreate the bug

1. Creating a new project `quarto create-project mybook --type book`
2. Edit `intro.qmd` with following:
```markdown

# Introduction

## My first section

## My second section
```
:point_up: Works as expected :point_down: 

![image](https://user-images.githubusercontent.com/81103/228829578-16f77217-280a-4a00-bc5d-42ede6146378.png)

3. Edit `intro.qmd` again and create sections using code blocks:
~~~qmd
# Introduction

```{python}
#| echo: false

from IPython.display import display, Markdown

display(Markdown("## My first section"))
display(Markdown("## My second section"))
```
~~~
This produces the sections as expected, but notice the **missing toc on the right**.

![image](https://user-images.githubusercontent.com/81103/228831801-bf3cbfb0-058a-4e55-b5ce-13e72d5d5c24.png)

## Environment
```bash
# Ubuntu 22.04 
>>> quarto --version
1.2.335
```
2023-03-30T12:13:28Z
atlasstrategic
closed
TOC (Table of Contents) not displaying when sections added using code blocks
https://github.com/quarto-dev/quarto-cli/issues/5037