Skip to content

Crash when using inline #| label: fig-* syntax with format: ipynb #13956

@mcanouil

Description

@mcanouil

Bug Description

Quarto crashes when rendering a document to ipynb format that contains a Python code cell with an inline figure label (#| label: fig-*).
The crash occurs during the Pandoc filter phase with the error: "Block, list of Blocks, or compatible element expected, got table".

The crash does not occur when:

  • Using --no-execute flag.
  • Using the div syntax (::: {#fig-test}) instead of the inline label.

Steps to Reproduce

---
title: Demo
format: ipynb
---

Inline label (crashes):

```{python}
#| label: fig-test2
print("This renders to part of a Markdown cell.")
```

Run quarto render demo.qmd.

Actual Behaviour

Error running filter /Users/mcanouil/Projects/quarto-dev/quarto-cli/src/resources/filters/main.lua:
Block, list of Blocks, or compatible element expected, got table
	while retrieving function argument content
	while retrieving arguments for function Div
stack traceback:
	...i/src/resources/filters/./customnodes/floatreftarget.lua:936: in field 'render'
	...to-dev/quarto-cli/src/resources/filters/./ast/render.lua:46: in local 'filter_fn'
	...v/quarto-cli/src/resources/filters/./ast/customnodes.lua:168: in function <...v/quarto-cli/src/resources/filters/./ast/customnodes.lua:158>
	(...tail calls...)
	...c/resources/pandoc/datadir/../../filters/modules/jog.lua:34: in upvalue 'run_filter_function'
	...c/resources/pandoc/datadir/../../filters/modules/jog.lua:223: in function <...c/resources/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	[C]: in function 'pandoc.List.map'
	...c/resources/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
	...c/resources/pandoc/datadir/../../filters/modules/jog.lua:222: in local 'jogger'
	...c/resources/pandoc/datadir/../../filters/modules/jog.lua:171: in upvalue 'recurse'
	...c/resources/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...c/resources/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	...v/quarto-cli/src/resources/filters/./ast/customnodes.lua:87: in function <...v/quarto-cli/src/resources/filters/./ast/customnodes.lua:65>
	(...tail calls...)
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:82: in local 'callback'
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:100: in upvalue 'run_emulated_filter_chain'
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:136: in function <.../quarto-cli/src/resources/filters/./ast/runemulation.lua:133>

Expected Behaviour

The document should render successfully to ipynb format, producing a Jupyter notebook with the code cell properly labelled as a figure.

Workaround

Use the div syntax instead of the inline label:

::: {#fig-test}

```{python}
print("This renders to part of a Markdown cell.")
```

:::

Your Environment

  • IDE: VSCode
  • OS: macOS (Darwin 25.2.0)

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.8.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.4.5: OK
      Typst version 0.14.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: f14ae36813513fb64d8c84c57e511c9321f61736
      Path: /Users/mcanouil/Projects/quarto-dev/quarto-cli/package/dist/bin

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

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

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
      Source: QUARTO_CHROMIUM

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

[✓] Checking R installation...........OK
      Version: 4.5.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/mcanouil/Projects/quarto-dev/quarto-playground/renv/library/macos/R-4.5/aarch64-apple-darwin20
        - /Users/mcanouil/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.5/aarch64-apple-darwin20/4cd76b74
      knitr: 1.51
      rmarkdown: 2.30

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

[✓] Checking Python 3 installation....OK
      Version: 3.14.2
      Path: /opt/homebrew/opt/python@3.14/bin/python3.14
      Jupyter: (None)

[✓] Checking Julia installation...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcrossref

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions