11---
22title : " Toggle"
3- subtitle : " Let readers control output visibility in Quarto documents "
3+ subtitle : " Give your readers control over what they see "
44format :
55 html :
66 toc : true
@@ -12,39 +12,62 @@ the output on demand.
1212
1313Think of it as the opposite of Quarto's
1414[ ` code-fold ` ] ( https://quarto.org/docs/output-formats/html-code.html#folding-code ) .
15- Instead of hiding code and showing output, toggle hides output and shows code.
15+ Instead of hiding code and showing output, Toggle ** hides output** and shows code.
1616
1717## Installation
1818
19+ To install the ` toggle ` extension, follow these steps:
20+
21+ 1 . Open your terminal.
22+
23+ 2 . Execute the following command:
24+
1925``` bash
2026quarto add coatless-quarto/toggle
2127```
2228
23- ## Quick Start
29+ This command will download and install the extension under the ` _extensions `
30+ subdirectory of your Quarto project. If you are using version control, ensure
31+ that you include this directory in your repository.
32+
33+ ### Requirements
34+
35+ - Quarto >= 1.7.0
2436
25- Add the filter and enable toggle for all cells:
37+ ## Usage
38+
39+ 1 . ** Add the filter** to your document's YAML header:
2640
2741``` yaml
28- extensions :
29- toggle :
30- output-toggle : true
42+ ---
43+ title : " My Document "
44+ format : html
3145filters :
3246 - toggle
47+ ---
3348```
3449
35- Hover over any code block to see the toggle button appear. Click to hide the
36- output; click again to show it.
37-
38- To enable toggle for specific cells only, omit ` output-toggle` and add
39- ` #| toggle: true` to individual cells:
50+ 2 . ** Enable toggle for specific code cells** by adding ` toggle: true ` :
4051
4152```` md
42- ` ` ` {{r }}
53+ ``` {{python }}
4354#| toggle: true
44- summary(mtcars )
55+ print("Hello, Python world!" )
4556```
4657````
4758
59+ That's it! A toggle button will now appear when you hover over the code block.
60+
61+ Want toggle on every cell? Add ` output-toggle: true ` at the document level:
62+
63+ ``` yaml
64+ extensions :
65+ toggle :
66+ output-toggle : true
67+ filters :
68+ - toggle
69+ ` ` `
70+
4871## Options
4972
5073Set these under ` extensions.toggle` or per-cell with `#|` comments:
@@ -58,28 +81,9 @@ Set these under `extensions.toggle` or per-cell with `#|` comments:
5881| `persist` | `false` | Remember state across page reloads |
5982| `button-text` | `"Output"` | Label shown on the button |
6083
61- # # Compatibility
62-
63- Works with HTML-based Quarto formats : documents, websites, books, and Revealjs
64- presentations.
65-
66- Toggle complements Quarto's
67- [`code-fold`](https://quarto.org/docs/output-formats/html-code.html#folding-code).
68- Use both together :
69-
70- ` ` ` yaml
71- format:
72- html:
73- code-fold: true
74- extensions:
75- toggle:
76- output-toggle: true
77- ` ` `
78-
79- PDF, Word, and other non-HTML formats are unaffected.
84+ Check out the guides in the sidebar to see each of these in action.
8085
81- # # Getting Help
86+ # # Questions?
8287
83- - [FAQ](qtoggle-faq.qmd) — Common questions
84- - [GitHub Issues](https://github.com/coatless-quarto/toggle/issues) — Bug reports
85- - [Discussions](https://github.com/coatless-quarto/toggle/discussions) — Questions
88+ - [FAQ](qtoggle-faq.qmd) — Quick answers to common questions
89+ - [GitHub Issues](https://github.com/coatless-quarto/toggle/issues) — Found a bug? Let us know
0 commit comments