lst-cap and lst-label in Quarto?

I have seen the documentation of the chunk options lst-cap and lst-label in Quarto, but I can't figure out how they work in practice. Here's some example code that does not work:

---
title: "Untitled"
format: html
editor: visual
---

```{r}
#| lst-label: lst-code
#| lst-cap: "Some R code"
a <- 1
a+1
```

I'd like to be able to reference the code chunk @lst-code.

Am I missing something about this?

1 Like

Okay, I've figured it out! Right now, list-label and lst-cap aren't available for executable code blocks. They only work for display code blocks. To get my example to have the labels, you'd need to replace the code chunk with

``` {#lst-code .r lst-cap="Some R code"}
a <- 1
a+1
```