Path: blob/main/tests/docs/consistency-checks/python-ref.qmd
6428 views
---
title: "Quarto Jupyter Cell Attribute Implementation Reference"
format:
html:
keep-md: true
code-background: true
jupyter: python3
---
I thought `output:false` would suppress the output, but no? `echo: false` does it.
```{python}
#| echo: false
import matplotlib.pyplot as plt
```
## `label`
```{python}
#| label: python-label-1
plt.plot([1,2,3,4])
plt.show()
```
**(Python Bug?) This appears to break with long labels:**
```{python}
#| label: python label 2
plt.plot([1,2,3,4])
plt.show()
```
### `fig-cap`
```{python}
#| label: fig-caption-test
#| fig-cap: A caption for the figure
plt.plot([1,2,3,4])
plt.show()
```
**(Styling Bug?) Centering of images appears inconsistent depending on whether they have captions?**
### `fig-subcap`
```{python}
#| label: fig-big-caption-test
#| fig-cap: Big caption
#| fig-subcap:
#| - Caption 1
#| - Caption 2
plt.plot([4,3,2,1])
plt.show()
plt.plot([1,2,3,4])
plt.show()
```
**(Python Bug?) Sub-captions don't show up unless `fig.cap` is also there:**
```{python}
#| label: fig-no-big-caption-test
#| fig-subcap:
#| - Caption 1
#| - Caption 2
plt.plot([4,3,2,1])
plt.show()
plt.plot([1,2,3,4])
plt.show()
```
### `code-fold` and `code-summary`
**(Inconsistency?) The R engine sets code-fold and code-summary for both the outer and inner div; The Python engine only forwards it to the inner div.**
Fold:
```{python}
#| code-fold: true
plt.plot([1,2,3,4])
plt.show()
```
Summary:
```{python}
#| code-summary: "Some text"
plt.plot([1,2,3,4])
plt.show()
```