-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluating R code with !expr
in fig-subcap
doesn't work
#2047
Comments
Can you upgrade to the latest prerelease version of quarto here? https://github.com/quarto-dev/quarto-cli/releases/tag/v1.1.109 You're likely seeing what's not a bug, but rather an issue in your YAML: !expr needs a string parameter, and so you need to escape those quotes. The latest version has better error messages in this case. |
Error is the same with 1.1.109.
I dont't understand your comment. The same code with ```{r}
#| label: fig-charts
#| fig-cap: !expr c("First", "Second")
plot(cars)
plot(pressure)
``` |
I apologize - I read the error message entirely wrong. Unfortunately, this won't be easy for us to fix right now; The issue is that the validator sees a datatype of string, and can't in general know that the output you're generating is an array of strings. You can work around this issue by disabling yaml validation for the entire document, with
But this means there won't be any validation of yaml across the entire quarto document. |
Does this mean you have special code to handle |
It's not that we have special r code for it. It's that the type of |
FYI - I just tried this 1.3.306 and it worked fine without having to invalidate the YAML. Perhaps this has been fixed? |
Just downloaded and installed 1.3.450 and it's not working for me. |
So I believe this works ok now, at least using Quarto 1.4 which is pre-release.
You'll still get the warning in YAML linting for what is mentioned already in this thread. So you should not need R to create a list ```{r}
#| label: fig-charts
#| fig-cap: Charts
#| fig-subcap:
#| - First
#| - Second
plot(cars)
plot(pressure)
``` New cross ref system allows you to express with Div figures and could be interesting to use inline code inside captions for example to avoid use of ---
title: "test"
format: html
---
See @fig-example-multiple-chunks, @fig-subfig-1 and @fig-subfig-2.
::: {#fig-example-multiple-chunks layout="[[ 25, 75 ]]"}
::: {#fig-subfig-1}
```{r}
#| echo: false
#| fig-width: 2
#| fig-height: 5
plot(cars)
```
This dataset has `r nrow(cars)` rows.
:::
```{r}
#| label: fig-subfig-2
#| fig-cap: "I don't care about the number of rows on this one."
#| echo: false
#| fig-width: 6
#| fig-height: 5
plot(pressure)
```
Charts
:::
Are we keeping this open to deal with YAML linting improvment about |
Let's close this issue now that we have one report specific to |
Bug description
It is documented that
!expr
works withfig-cap
, but it doesn't work withfig-subcap
.I get the following error when running
quarto render
on the file:quarto check
Outputquarto tools check
OutputChecklist
quarto check
in the "Quarto Check Output" text area?quarto tools check
in the "Quarto Tools Check Output" text area?The text was updated successfully, but these errors were encountered: