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
Copy file name to clipboardExpand all lines: README.md
+61-4Lines changed: 61 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,12 @@ quarto add coatless-quarto/toggle
16
16
17
17
This command will download and install the extension under the `_extensions` subdirectory of your Quarto project. If you are using version control, ensure that you include this directory in your repository.
18
18
19
+
### Requirements
20
+
21
+
To use the `toggle` extension, ensure you have the following:
22
+
23
+
- Quarto >= 1.7.0
24
+
19
25
## Quick Start
20
26
21
27
1.**Add the filter** to your document's YAML header:
@@ -122,10 +128,11 @@ You can enable toggle functionality for all code cells in your document by addin
122
128
---
123
129
title: "My Document"
124
130
format: html
125
-
toggle:
126
-
output-toggle: true # Enable toggle functionality
127
-
output-hidden: false # Show outputs initially (default)
128
-
output-sync: false # Individual control (default)
131
+
extensions:
132
+
toggle:
133
+
output-toggle: true # Enable toggle functionality
134
+
output-hidden: false # Show outputs initially (default)
|`output-sync`| boolean |`false`| Synchronize all outputs in cell |
148
+
|`global-toggle`| boolean |`false`| Show a global toggle button to control all outputs |
149
+
|`persist`| boolean |`false`| Save toggle state in localStorage |
150
+
|`button-text`| string |`"Output"`| Custom text for the toggle button |
141
151
142
152
> [!IMPORTANT]
143
153
>
144
154
> To avoid confusion with the `toggle` document-level key, the document-level configuration uses `output-toggle` instead of `toggle` for enabling the toggle functionality globally.
145
155
156
+
#### Global Toggle Button
157
+
158
+
Add a floating button that controls all toggleable outputs on the page:
159
+
160
+
```yaml
161
+
extensions:
162
+
toggle:
163
+
output-toggle: true
164
+
global-toggle: true
165
+
```
166
+
167
+
#### Persist Toggle State
168
+
169
+
Remember the user's toggle preferences across page reloads:
170
+
171
+
```yaml
172
+
extensions:
173
+
toggle:
174
+
output-toggle: true
175
+
persist: true
176
+
```
177
+
178
+
#### Custom Button Text
179
+
180
+
Change the default "Output" label on toggle buttons:
181
+
182
+
```yaml
183
+
extensions:
184
+
toggle:
185
+
output-toggle: true
186
+
button-text: "Result"
187
+
```
188
+
189
+
You can also customize per-cell:
190
+
191
+
````markdown
192
+
```{python}
193
+
#| toggle: true
194
+
#| button-text: "Answer"
195
+
print("The answer is 42")
196
+
```
197
+
````
198
+
146
199
147
200
148
201
#### Priority of Settings
@@ -151,6 +204,10 @@ filters:
151
204
- If no cell-level setting is provided, document-level settings apply
152
205
- If neither is provided, toggle is not enabled for that cell
153
206
207
+
## Documentation
208
+
209
+
For more examples and detailed guides, visit the [documentation site](https://quarto.thecoatlessprofessor.com/toggle/).
210
+
154
211
## Help
155
212
156
213
To report a bug, please [add an issue](https://github.com/coatless-quarto/toggle/issues/new) to the repository's [bug tracker](https://github.com/coatless-quarto/toggle/issues).
0 commit comments