Passing an id to a code cell #10229
-
DescriptionQuestionIs there a way to pass a pandoc id to the top level block that is created by a code cell (the ExamplesWhen doing a crossref, you can the ---
format: native
---
```{r}
#| label: fig-histplot
hist(rnorm(5))
```
However, if you try to use that logic to generically assign an id to the enclosing ---
format: native
---
```{r}
#| label: histplot
hist(rnorm(5))
```
Note that not only is a non-prefixed label not propagated into the AST, there is a filter that scrubs that attribute from the block. The behavior that I'd like to seeFundamentally, I'd like to be able to create an AST that looks like
where the enclosing One approach to implementation would be to assign the value of Thanks! $ quarto --version
1.5.47 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I also note that
I'm assuming that the ID moving to the output is part of making crossrefs work in Quarto, but it does complicate our use case, @andrewpbray! |
Beta Was this translation helpful? Give feedback.
-
quite a complex topic today - we would need to think of the best way to allow such addition. The The two mechanism in Quarto are the following:
an id of the div is quite specific, and there is no mechanism for id. This means you could do ---
format: native
---
```{r}
#| custom-id: '#histplot'
hist(rnorm(5))
```
Then a Lua filter to catch
I can't find it, but I wonder if this is not an alias... 🤔 Specificity of knitr engine.knitr has a concept of For Quarto, they will work to pass to If you try for example ---
format: native
---
```{r}
#| attr-source: '#histplot'
hist(rnorm(5))
```
---
format: native
---
```{r}
#| attr-output: '#histplot'
1 + 1
```
Like in knitr directly. No application for plot output for example. So as you see, several layer of things going on. If this needs improvement, we need to think about it carefully |
Beta Was this translation helpful? Give feedback.
quite a complex topic today - we would need to think of the best way to allow such addition.
The
Div
of classcell
is really something from quarto, with quite some internal usage.The two mechanism in Quarto are the following:
classes
allows to set classes to Div of class cell.an id of the div is quite specific, and there is no mechanism for id.
This means you could do