quarto-dev / quarto-dev/quarto-cli
manuscript project not rendering when there is a labelled code chunck
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
A qmd document is well rendered with figures and tables labelled. But when the document is used as manuscript project, quarto fails to render the manuscript project if there one labelled code chunck. Jupyter kernel starts and carries out the computation in the code chunck but quarto fails to render if there is at least one labelled code chunk: I have tested *| label: fig-tagand *|tbl-tag.
Steps to reproduce
---
title: Quarto Manuscript Default Project
authors:
- name: Norah Jones
affiliation: The University
roles: writing
corresponding: true
bibliography: references.bib
jupyter: nbstata
---
## Section
This is a simple placeholder for the manuscript's main document [@knuth84].
The document fails to render once the below code chunk @fig-figuretag1 is labelled with `*| label: fig-figurelabel`.
```{stata}
*| label: fig-figuretag1
*| fig-cap: From code chunck
*| echo: false
qui webuse auto, clear
scatter price mpg
```
The same happens if there is one table code chunk labelle with `*| label: tbl-tablelabel`.
@fig-figuretag1 worked well from code chunk.
and @tbl-tabletag1 embedded after being produced in a the code chunk below.
```{stata}
*| include: false
table foreign, stat(mean price) stat(sd price)
collect layout (foreign) (result)
collect style cell result, font("Trade Gothic Next", bold size(12))
collect export tab1, as(html) replace
```
Even here we refer to the same html table @tbl-tabletag1
::: {#tbl-tabletag1}
```{stata}
*| echo: false
*| output: asis
display "```{=html}"
type tab1.html
display "```"
```
Produced dynamically from formatted html table
:::
```{stata}
*| echo: false
*| include: false
table foreign, stat(mean price) stat(sd price)
collect layout (foreign) (result)
*collect style cell result, font("Trade Gothic Next", bold size(12))*
collect export tab2, as(md) replace
```
And when @tbl-tabletag2 is produced from Markdown table
::: {#tbl-tabletag2}
```{stata}
*| echo: false
*| output: asis
type tab2.md
```
Produced dynamically from md table
:::
The End
Expected behavior
The qmd document should render and add cross-reference in a single document as well as in manuscript project.
Actual behavior
In a manuscript project the same document fails to render if there is at least one labelled code chunk, be it labelle with code chuck label: tbl-, label: fig- or fenced div.
When there is a *| label: fig- in the index.qmd, there produced error is:
Rendering qmd embeds [index.qmd]
Rendering output notebook [index.qmd]
Error running filter /Applications/quarto/share/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:
/Applications/quarto/share/filters/main.lua:22368: in field 'render'
/Applications/quarto/share/filters/main.lua:1233: in local 'filter_fn'
/Applications/quarto/share/filters/main.lua:635: in function </Applications/quarto/share/filters/main.lua:625>
(...tail calls...)
[C]: in ?
[C]: in method 'walk'
/Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
(...tail calls...)
/Applications/quarto/share/filters/main.lua:1334: in local 'callback'
/Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
/Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>
stack traceback:
/Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
(...tail calls...)
/Applications/quarto/share/filters/main.lua:1334: in local 'callback'
/Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
/Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>
When using ::: {#tbl-tabletag1} in the index.qmd, the error is:
Rendering qmd embeds [index.qmd]
Error running filter /Applications/quarto/share/filters/main.lua:
/Applications/quarto/share/filters/main.lua:22378: attempt to index a nil value (field 'content')
stack traceback:
/Applications/quarto/share/filters/main.lua:1233: in local 'filter_fn'
/Applications/quarto/share/filters/main.lua:635: in function </Applications/quarto/share/filters/main.lua:625>
(...tail calls...)
[C]: in ?
[C]: in method 'walk'
/Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
(...tail calls...)
/Applications/quarto/share/filters/main.lua:1334: in local 'callback'
/Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
/Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>
stack traceback:
/Applications/quarto/share/filters/main.lua:557: in function </Applications/quarto/share/filters/main.lua:546>
(...tail calls...)
/Applications/quarto/share/filters/main.lua:1334: in local 'callback'
/Applications/quarto/share/filters/main.lua:1352: in upvalue 'run_emulated_filter_chain'
/Applications/quarto/share/filters/main.lua:1388: in function </Applications/quarto/share/filters/main.lua:1385>
Your environment
- IDE: VSCode 1.94.2
- MacOS Sequoia 15.0.1
Quarto check output
(base) m1pro14@MacBookPro q_ms % quarto check
Quarto 1.5.57
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.2.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.41.0: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.5.57
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: Installation From Path
Path: /Library/TeX/texbin
Version: 2024
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.11.5 (Conda)
Path: /Users/m1pro14/anaconda3/bin/python
Jupyter: 5.3.0
Kernels: nbstata, python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.4.1
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
knitr: 1.48
rmarkdown: 2.27
[✓] Checking Knitr engine render......OK
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the manuscript project's index.qmd, comparing labelled figure/table code chunks and fenced divs. Start from the reported rendering path and main.lua errors, then verify that the manuscript renders successfully with cross-references preserved, as the standalone qmd already does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100