quarto-dev / quarto-dev/quarto-cli
linting: warn when `renderings` is combined with crossref cell options
@gordonwoodhull is already working on this.
Since Jun 20, 2025.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Currently Quarto will silently produce bad output when renderings is combined with label: fig-* or other cell options that create a cross-reference.
This is because cell-renderings.lua is a simple Lua filter which operates at one point in the pipeline, whereas crossrefs affect engine output and many other stages in the pipeline.
And they want to do different thing with multiple outputs... We may never want to support renderings x subfigures on a single cell.
So we require only renderings on the cell, and (sub)figures must be expressed with fenced divs.
example
---
title: matplotlib
engine: jupyter
keep-md: true
format:
html:
code-tools:
source: https://github.com/quarto-dev/quarto-examples/blob/main/renderings/matplotlib.qmd
---
```{python}
#| echo: false
from quarto import theme_brand_matplotlib
light_style = theme_brand_matplotlib("light-brand.yml")
dark_style = theme_brand_matplotlib("dark-brand.yml")
```
```{python}
#| label: fig-bad
#| fig-cap: this is bad
#| echo: false
#| renderings: [light, dark]
import numpy as np
import matplotlib.pyplot as plt
# Parameters for the normal distribution
mean = 0
std_dev = 1
# Generate data
x = np.linspace(mean - 4*std_dev, mean + 4*std_dev, 1000)
y = (1/(std_dev * np.sqrt(2 * np.pi))) * np.exp(-0.5 * ((x - mean) / std_dev)**2)
# Plotting
light_style()
plt.figure(figsize=(8, 5))
plt.plot(x, y, label='Normal Distribution')
plt.grid(True)
plt.show()
dark_style()
plt.figure(figsize=(8, 5))
plt.plot(x, y, label='Normal Distribution')
plt.grid(True)
plt.show()
```
Currently this produces the unhelpful (but mostly unimprovable) Lua warning
(W) need 2 cell-output-display for renderings light,dark; got 0
and the following output
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.
Assessment
This issue has not been assessed yet.