Skip to content

Unexpected behaviour of heading following executable code block #12440

@jsquaredosquared

Description

@jsquaredosquared

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingconvertRelated to quarto convert commandengines-jupyterAnything related to Jupyter engine

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions