You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document demonstrates how to use the `toggle` filter in Quarto. The filter allows you to control the visibility of code chunks based on a custom attribute.
## Usage
To use the `toggle` filter, you need to specify a custom attribute in your code chunk options. The attribute can be set to `true` or `false`, which will determine whether the code chunk is displayed or hidden in the output.
Let's look at an example of it in action:
```{r}
#| toggle: true
print("Hello, world!")
```
If the `toggle` attribute is set to `false` or is missing, the toggle option will not be available in the rendered document.
```{r}
#| toggle: false
print("Goodbye, world!")
```
```{r}
print("Missing, world!")
```
## Other special cases
STDError Testing:
```{r}
#| toggle: true
warning("This is a warning message.")
```
Graph testing:
```{r}
#| toggle: true
plot(1:10, 10:1)
```
Multi-line testing:
```{r}
#| toggle: true
print("This is a multi-line code chunk.")
print("It should be displayed when the toggle is set to true.")