Closed Gewerd-Strauss closed 9 months ago
Thanks for the report!
Note that you should note use level 1 header[^1] in callouts and you should not mix YAML and inline syntax for code cell.
::: {.callout-caution collapse="true"}
## This is valid
This is content
:::
```{r}
#| label: fig-codeblock1
#| fig-cap: "MPG vs horsepower, colored by transmission."
library(ggplot2)
mtcars2 <- mtcars
mtcars2$am <- factor(
mtcars$am, labels = c('automatic', 'manual')
)
ggplot(mtcars2, aes(hp, mpg, color = am)) +
geom_point() + geom_smooth(formula = y ~ x, method = "loess") +
theme(legend.position = 'bottom')
---
A smaller example showing the issue with the structure, which actually is not really about the collapse part itself as it can be seen that the structure is clearly wrong.
````qmd
---
format: html
toc-location: left
fig-cap-location: margin
---
::: {.callout-caution collapse="true"}
## Expand To Learn About Collapse Original
This is an example.
:::
::: {.callout-caution collapse="true"}
## Expand To Learn About Collapse with Image
```{r}
#| fig-cap: "MPG vs horsepower, colored by transmission."
plot(1)
:::
<img width="1624" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/8896044/050a70ed-8131-4b23-b9f2-e319b526459d">
[^1]: See <https://quarto.org/docs/authoring/callouts.html#markdown-syntax>.
Possibly related to #7153
Bug description
Hello,
assume the first qmd-file shown below, and render it to html by executing the following command in a shell launched within the qmd-file's working directory:
This is a simple modification of this example on callouts to include a figure within a callout. When converting to html, callouts can be flagged as collapsable via
collapse="true"
. If a callout contains a code-block which renders a figure, andtoc-location
is set toleft
, the callout can no longer be folded. While the small triangle in the callout's header remains responsive, the callout itself seems to fold-then-unfold in rapid succession, thus being always expanded.If
toc-location
is set toright
orbody
, this issue does not manifest. Iffig-cap-location
is set to anything butmargin
, this issue does not manifest.I hope these information are sufficient, and will gladly give further details if requested. This issue is not tested for in other output-formats.
Thank you for this absurdly useful utility.
Sincerely, ~Gw
Steps to reproduce
Working:
:::
Title 2
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Title 2.Aee
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
:::
Title 2
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Title 2.Aee
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.