Skip to content

Comments in Code cells are taken as section and increment numbering #11835

@mcanouil

Description

@mcanouil

Bug description

A comment in a code cell (qmd/ipynb) # a comment lead to the wrong overall header level to be used in the document for Typst and LaTeX formats.

Note that the behaviour is observed for all engines.

Steps to reproduce

Render the following document into Typst or LaTeX PDF.

InputOutput
---
title: XXXX
format:
  typst: default
  pdf: default
number-sections: true
jupyter: python3
---

## Introduction

```{python}
# Import libraries for loading the dataset

print("Hello World")
```

### Subsection

{{< lipsum 1 >}}
Image

Expected behavior

Without having to double the comment symbol or use shift-heading-level-by: -1.

InputOutput
---
title: XXXX
format:
  typst: default
  pdf: default
number-sections: true
jupyter: python3
---

## Introduction

```{python}
## Import libraries for loading the dataset

print("Hello World")
```

### Subsection

{{< lipsum 1 >}}
Image

Your environment

  • macOS Sequoia (latest)

Quarto check output

Quarto 99.9.9
[✓] Checking environment information...
      Quarto cache location: /Users/mcanouil/Library/Caches/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: 99.9.9
      commit: d0d6f87e18e7522386bc8b1ab5b390ef7eca3799
      Path: /Users/mcanouil/Projects/quarto/quarto-cli/package/dist/bin

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

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/mcanouil/Library/TinyTeX/bin/universal-darwin
      Version: 2024

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

[✓] Checking Python 3 installation....OK
      Version: 3.13.1
      Path: /Users/mcanouil/Projects/quarto/quarto-playground/.venv/bin/python3
      Jupyter: 5.7.2
      Kernels: julia-1.11, python3

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

(|) Checking R installation...........ℹ R version 4.4.2 (2024-10-31)
! Config '~/.Rprofile' was loaded!
[✓] Checking R installation...........OK
      Version: 4.4.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/mcanouil/Projects/quarto/quarto-playground/renv/library/macos/R-4.4/aarch64-apple-darwin20
        - /Users/mcanouil/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.4/aarch64-apple-darwin20/f7156815
      knitr: 1.48
      rmarkdown: 2.29

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglatexLaTeX engines related libraries and technologiestypst

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions