quarto-dev / quarto-dev/quarto-cli

Unexpected behaviour of heading following executable code block

Open
#12,440 5 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Apr 4, 2025.

bug convert engines-jupyter
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

If title is not explicitly set in the yaml frontmatter, the heading immediately following an executable code block (i.e., ```{python}) is used as the title of the document. This bug does not happen when the code block is not executable (i.e., ```python).

Steps to reproduce
InputOutput
---
format: typst
---

# This is what happens when I don't set the title.

## This is a level 2 heading

This is some paragraph text.

```{python}
# This is an executable Python code block.
print("This is the output of an executable Python code block.")
```

## This is another level 2 heading

This is some more paragraph text.

Image

Actual behavior

No response

Expected behavior
InputOutput
---
format: typst
title: Title
---

# This is what happens when I set the title.

## This is a level 2 heading

This is some paragraph text.

```{python}
# This is an executable Python code block.
print("This is the output of an executable Python code block.")
```

## This is another level 2 heading

This is some more paragraph text.

Image

Your environment
  • IDE: VSCode 1.98.2
  • OS: Linux Pop!_OS 22.04
Quarto check output
Quarto 1.6.42
[✓] Checking environment information...
      Quarto cache location: /home/jj/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.6.42
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

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

[✓] Checking Python 3 installation....OK
      Version: 3.13.1
      Path: /home/jj/Desktop/quarto_bug/.venv/bin/python3
      Jupyter: 5.7.2
      Kernels: python3, coconut_py, coconut, coconut_py2, xonsh, coconut_py3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.3
      Path: /usr/lib/R
      LibPaths:
        - /home/jj/R/x86_64-pc-linux-gnu-library/4.4
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.49
      rmarkdown: 2.29

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

maybe related to this issue? idk

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.