-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.qmd
More file actions
59 lines (43 loc) · 1.15 KB
/
example.qmd
File metadata and controls
59 lines (43 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: "Example Toggle"
format: html
engine: knitr
filters:
- toggle
---
# Overview
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.")
plot(1:10, 10:1)
print("This is the final line.")
```