Skip to content

Commit f5a4975

Browse files
committed
Docs... Lots of Docs.
1 parent be93385 commit f5a4975

15 files changed

+1535
-362
lines changed

docs/_quarto.yml

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,52 @@ website:
88
repo-actions: [edit, issue]
99
sidebar:
1010
logo: "toggle-animated-logo.svg"
11-
logo-alt: "A hexagon logo for the toggle Quarto extension."
11+
logo-alt: "Toggle extension logo"
1212
style: "floating"
1313
search: true
1414
tools:
1515
- icon: github
1616
href: https://github.com/coatless-quarto/toggle/
17-
contents:
18-
- text: "Home"
19-
file: index.qmd
20-
- section: "Examples"
17+
contents:
18+
- section: "Get Started"
2119
contents:
22-
- text: "Toggle for All Cells"
23-
href: qtoggle-all-cells-example.qmd
24-
- text: "Toggle Specific Cells"
25-
href: qtoggle-specific-cells-example.qmd
26-
- section: "Support"
20+
- text: "Home"
21+
href: index.qmd
22+
- text: "Quick Start"
23+
href: qtoggle-quick-start.qmd
24+
- section: "Features"
2725
contents:
26+
- text: "Hide by Default"
27+
href: qtoggle-hidden-default.qmd
28+
- text: "Sync Multiple Outputs"
29+
href: qtoggle-sync-mode.qmd
30+
- text: "Global Control"
31+
href: qtoggle-global-toggle.qmd
32+
- text: "Remember State"
33+
href: qtoggle-persistence.qmd
34+
- text: "Custom Labels"
35+
href: qtoggle-custom-text.qmd
36+
- section: "Demos"
37+
contents:
38+
- text: "Nested Containers"
39+
href: qtoggle-nested-containers.qmd
40+
- text: "Data Analysis Demo"
41+
href: qtoggle-demo.qmd
42+
- section: "Reference"
43+
contents:
44+
- text: "Custom Styling"
45+
href: qtoggle-styling.qmd
2846
- text: "FAQ"
2947
href: qtoggle-faq.qmd
30-
- text: "Submit an issue"
31-
href: https://github.com/coatless-quarto/toggle/issues/new/choose
32-
- section: "Extra"
33-
contents:
34-
- qtoggle-release-notes.qmd
48+
- text: "Release Notes"
49+
href: qtoggle-release-notes.qmd
50+
- text: "---"
51+
- text: "Report Issue"
52+
href: https://github.com/coatless-quarto/toggle/issues/new/choose
3553

36-
format:
54+
format:
3755
html:
3856
toc: true
57+
theme:
58+
light: flatly
59+
dark: darkly

docs/index.qmd

Lines changed: 50 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,85 @@
11
---
2-
title: "Home"
3-
format:
2+
title: "Toggle"
3+
subtitle: "Let readers control output visibility in Quarto documents"
4+
format:
45
html:
5-
toc: false
6+
toc: true
67
---
78

8-
The `toggle` extension allows you to toggle between showing code with output or just code by itself in Quarto HTML documents by adding a convenient toggle button that appears when hovering over code blocks, similar to the copy button.
9+
Ever wished readers could hide verbose output while keeping the code visible?
10+
The `toggle` extension adds a button to your code blocks that shows or hides
11+
the output on demand.
912

10-
## Installation
11-
12-
To install the `toggle` extension, follow these steps:
13-
14-
1. Open your terminal.
13+
Think of it as the opposite of Quarto's
14+
[`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.
1516

16-
2. Execute the following command:
17+
## Installation
1718

1819
```bash
1920
quarto add coatless-quarto/toggle
2021
```
2122

22-
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.
23-
24-
## Usage
23+
## Quick Start
2524

26-
At the top of your Quarto document, include the `filters` key with `toggle` specified in the YAML header:
25+
Add the filter and enable toggle for all cells:
2726

2827
```yaml
29-
---
30-
title: "My Document"
31-
format: html
28+
extensions:
29+
toggle:
30+
output-toggle: true
3231
filters:
3332
- toggle
34-
---
3533
```
3634
37-
This will allow the toggle extension to be applied to your document.
38-
39-
### Cell-Level Configuration
35+
Hover over any code block to see the toggle button appear. Click to hide the
36+
output; click again to show it.
4037
41-
To enable toggle functionality for a specific code cell, add the `toggle: true` attribute:
42-
43-
````md
44-
```{{python}}
45-
#| toggle: true
46-
print("Hello, Python world!")
47-
```
48-
````
49-
50-
You can also set whether the output is shown or hidden by default using the `output-hidden` attribute:
38+
To enable toggle for specific cells only, omit `output-toggle` and add
39+
`#| toggle: true` to individual cells:
5140

5241
````md
5342
```{{r}}
5443
#| toggle: true
55-
#| output-hidden: true
56-
print("Hello, R world!")
44+
summary(mtcars)
5745
```
5846
````
5947

60-
This will hide the output by default, and the user can click the toggle button to show it.
48+
## Options
6149

62-
### Document-Level Configuration
50+
Set these under `extensions.toggle` or per-cell with `#|` comments:
6351

64-
You can enable toggle functionality for all code cells in your document by adding the following to your YAML header:
52+
| Option | Default | Purpose |
53+
|--------|---------|---------|
54+
| `output-toggle` | `false` | Add toggle buttons to all cells |
55+
| `output-hidden` | `false` | Start with outputs collapsed |
56+
| `output-sync` | `false` | Sync all outputs in a cell together |
57+
| `global-toggle` | `false` | Floating button to toggle everything |
58+
| `persist` | `false` | Remember state across page reloads |
59+
| `button-text` | `"Output"` | Label shown on the button |
6560

66-
```yaml
67-
---
68-
title: "My Document"
69-
format: html
70-
toggle:
71-
output-toggle: true # Enable toggle buttons for all cells
72-
output-hidden: false # Show outputs initially (default)
73-
filters:
74-
- toggle
75-
---
76-
```
61+
## Compatibility
7762

78-
#### Priority of Settings
63+
Works with HTML-based Quarto formats: documents, websites, books, and Revealjs
64+
presentations.
7965

80-
- Cell-level settings override document-level settings
81-
- If no cell-level setting is provided, document-level settings apply
82-
- If neither is provided, toggle is not enabled for that cell
66+
Toggle complements Quarto's
67+
[`code-fold`](https://quarto.org/docs/output-formats/html-code.html#folding-code).
68+
Use both together:
8369

84-
## Help
70+
```yaml
71+
format:
72+
html:
73+
code-fold: true
74+
extensions:
75+
toggle:
76+
output-toggle: true
77+
```
8578

86-
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).
79+
PDF, Word, and other non-HTML formats are unaffected.
8780

88-
Want to contribute a feature? Please open an issue ticket to discuss the feature before sending a pull request.
81+
## Getting Help
8982

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

docs/qtoggle-all-cells-example.qmd

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)