Skip to content

Commit 8f5107b

Browse files
committed
And the README.md file.....
1 parent f5a4975 commit 8f5107b

File tree

1 file changed

+61
-4
lines changed

1 file changed

+61
-4
lines changed

README.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ quarto add coatless-quarto/toggle
1616

1717
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.
1818

19+
### Requirements
20+
21+
To use the `toggle` extension, ensure you have the following:
22+
23+
- Quarto >= 1.7.0
24+
1925
## Quick Start
2026

2127
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
122128
---
123129
title: "My Document"
124130
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)
135+
output-sync: false # Individual control (default)
129136
filters:
130137
- toggle
131138
---
@@ -138,11 +145,57 @@ filters:
138145
| `output-toggle` | boolean | `false` | Enable toggle functionality |
139146
| `output-hidden` | boolean | `false` | Hide outputs initially |
140147
| `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 |
141151

142152
> [!IMPORTANT]
143153
>
144154
> 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.
145155
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+
146199
147200
148201
#### Priority of Settings
@@ -151,6 +204,10 @@ filters:
151204
- If no cell-level setting is provided, document-level settings apply
152205
- If neither is provided, toggle is not enabled for that cell
153206
207+
## Documentation
208+
209+
For more examples and detailed guides, visit the [documentation site](https://quarto.thecoatlessprofessor.com/toggle/).
210+
154211
## Help
155212
156213
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

Comments
 (0)