Skip to content

Typst: Unnumbered headings wrapped in extraneous block element #13212

@CoryMcCartan

Description

@CoryMcCartan

I have:

  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide

Bug description

When you have a heading that is unnumbered, as happens e.g. with the "Level two" heading below, Quarto converts it not to a Typst heading but one wrapped in a #block()

There may be a very good reason for this behavior, in which case I apologize, but the document renders fine without the #block, and indeed numbered headings are not wrapped in a #block().
The reason it causes problems is that I would like to render these headings inline (like paragraphs in TeX; Quarto has a block-headings option for that format which controls this), which I would accomplish with a show rule something like this:

show heading: it => {
    if it.numbering == none {
        it.body
    } else {
        block(counter(heading).display(it.numbering) + h(1em) + it.body)
    }
}

However, because the heading gets wrapped in a #block, this is not possible.

Looks like the expansion into the full #heading() call happens here, but I don't see there where the #block is applied.

Steps to reproduce

---
format: 
    typst:
        keep-typ: true
        number-depth: 1
---

# Level one

## Level two

Actual behavior

in Typst output:

// ... (template code)
= Level one
<level-one>
#block[
#heading(
level: 
2
, 
numbering: 
none
, 
[
Level two
]
)
]

Expected behavior

// ... (template code)
= Level one
<level-one>

#heading(level: 2, numbering: none, [Level two])

Your environment

  • OS: MacOS 15.6
  • IDE: none

Quarto check output

Quarto 1.7.29
[✓] Checking environment information...
      Quarto cache location: /Users/cmccartan/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.85.1: OK
      Deno version 1.46.3: OK
      NOTE: Typst version 0.13.1 does not strictly match 0.13.0 and strict checking is enabled. Please use 0.13.0.
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.7.29
      Path: /Applications/quarto/bin

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

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

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location

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

[✓] Checking Python 3 installation....OK
      Version: 3.9.6
      Path: /Library/Developer/CommandLineTools/usr/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.5.0
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
      knitr: 1.50
      rmarkdown: 2.29

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtypst

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions