File tree Expand file tree Collapse file tree 4 files changed +67
-68
lines changed Expand file tree Collapse file tree 4 files changed +67
-68
lines changed Original file line number Diff line number Diff line change 1+ # sphinx-togglebutton
2+
3+ A small sphinx extension to make it possible to add a "toggle button" to
4+ sections of your page.
5+
6+ ![ demo gif] ( docs/_static/demo.gif )
7+
8+
9+ Installation
10+ ============
11+
12+ You can install ` sphinx-togglebutton ` with ` pip ` :
13+
14+ ``` bash
15+ pip install sphinx-togglebutton
16+ ```
17+
18+ Usage
19+ =====
20+
21+ In your ` conf.py ` configuration file, add ` sphinx_togglebutton `
22+ to your extensions list.
23+
24+ E.g.:
25+
26+ ``` python
27+ extensions = [
28+ ...
29+ ' sphinx_togglebutton'
30+ ...
31+ ]
32+ ```
33+ Now, whenever you wish for an admonition to be toggle-able, add the
34+ ` :class: toggle ` parameter to the admonition directive that you use.
35+
36+ For example, this code would create a toggle-able "note" admonition:
37+
38+ ``` rst
39+ .. note::
40+ :class: toggle
41+
42+ This is my note.
43+ ```
44+
45+ Clicking on the toggle button will toggle the item's visibility.
46+
47+ You may also ** hide the content by default** . To do so, add the ` toggle `
48+ class * as well as* a ` toggle-hidden ` class, like so:
49+
50+ ``` rst
51+ .. note::
52+ :class: toggle, toggle-hidden
53+
54+ This is my note.
55+ ```
56+
57+ You can also use ** containers** to add arbitrary toggle-able code. For example,
58+ here's a container with an image inside:
59+
60+ ``` rst
61+ .. container:: toggle, toggle-hidden
62+
63+ .. admonition:: Look at that, an image!
64+
65+ .. image:: https://media.giphy.com/media/mW05nwEyXLP0Y/giphy.gif
66+ ```
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1717 version = version ,
1818 description = "Add a toggle button to items on a page." ,
1919 long_description = readme_text ,
20- long_description_content_type = "text/x-rst " ,
20+ long_description_content_type = "text/markdown " ,
2121 author = "Chris Holdgraf" ,
22222323 url = "https://github.com/choldgraf/sphinx-togglebutton" ,
You can’t perform that action at this time.
0 commit comments