-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
15,495 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
graft doc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
=================== | ||
sphinx-togglebutton | ||
=================== | ||
|
||
A small sphinx extension to make it possible to add a "toggle button" to | ||
sections of your page. | ||
|
||
|
||
Installation | ||
============ | ||
|
||
You can install ``sphinx-togglebutton`` with ``pip``: | ||
|
||
.. code:: bash | ||
pip install sphinx-togglebutton | ||
Usage | ||
===== | ||
|
||
In your ``conf.py`` configuration file, add ``sphinx_togglebutton`` | ||
to your extensions list. | ||
|
||
E.g.: | ||
|
||
.. code:: python | ||
extensions = [ | ||
... | ||
'sphinx_togglebutton' | ||
... | ||
] | ||
Now, whenever you wish for an admonition to be toggle-able, add the | ||
``:class: toggle`` parameter to the admonition directive that you use. | ||
|
||
For example, this code would create a toggle-able "note" admonition: | ||
|
||
.. code:: rst | ||
.. note:: | ||
:class: toggle | ||
This is my note. | ||
Clicking on the toggle button will toggle the item's visibility. | ||
|
||
You may also **hide the content by default**. To do so, add the ``toggle`` | ||
class *as well as* a ``toggle-hidden`` class, like so: | ||
|
||
.. code:: rst | ||
.. note:: | ||
:class: toggle, toggle-hidden | ||
This is my note. | ||
You can also use **containers** to add arbitrary toggle-able code. For example, | ||
here's a container with an image inside: | ||
|
||
.. code:: rst | ||
.. container:: toggle, toggle-hidden | ||
.. admonition:: Look at that, an image! | ||
.. image:: https://media.giphy.com/media/mW05nwEyXLP0Y/giphy.gif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Instructions for creating a new release | ||
|
||
Spinx-Copybutton is [hosted on the pypi repository](https://pypi.org/project/sphinx-togglebutton/). | ||
To create a new release of Sphinx-Togglebutton, you need to do these things: | ||
|
||
## Before you start | ||
|
||
1. Ensure that you have push access to the [Sphinx-Togglebutton pypi repository](https://pypi.org/project/sphinx-togglebutton/) | ||
2. Install [the twine package](https://twine.readthedocs.io/en/latest/). This is a package that helps you | ||
bundle and push new Python package distributions to pip. | ||
|
||
## To create the release | ||
|
||
To create a new release, [open an issue](https://github.com/choldgraf/sphinx-togglebutton/issues/new) to keep | ||
track of the to-do list for the release. Copy/paste the following markdown into the issue | ||
and check off the boxes as you complete items: | ||
|
||
|
||
``` | ||
- [ ] Ensure that the [Sphinx-Togglebutton version number](https://github.com/choldgraf/sphinx-togglebutton/blob/master/jupyter_book/__init__.py) | ||
is correct, and remove the `dev0` part of the version number. | ||
Make a PR with the new number and merge into master. | ||
- [ ] Create a new distribution for Sphinx-Togglebutton by | ||
[following the twine release instructions](https://twine.readthedocs.io/en/latest/#using-twine) | ||
- [ ] Confirm that the new version of Sphinx-Togglebutton [is posted to pypi](https://pypi.org/project/sphinx-togglebutton/) | ||
- [ ] Bump the [Sphinx-Togglebutton version number](https://github.com/choldgraf/sphinx-togglebutton/blob/master/jupyter_book/__init__.py) to | ||
the next minor (or major) release and append `dev0` to the end. | ||
- [ ] Celebrate! You've just released a new version of Sphinx-Togglebutton! | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = SphinxCopybutton | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: ff22d77a4441142d6ff9a9e56e46bd09 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
========================== | ||
sphinx-togglebutton | ||
========================== | ||
|
||
A small sphinx extension to make it possible to add a "toggle button" to | ||
sections of your page. | ||
|
||
For example, click the "-" button to the right: | ||
|
||
.. note:: Here's a toggled admonition | ||
:class: toggle | ||
|
||
It was created with this code: | ||
|
||
.. code:: rst | ||
.. note:: Here's a toggled admonition | ||
:class: toggle | ||
(admonition body here) | ||
And here's a code block: | ||
|
||
.. container:: toggle | ||
|
||
.. code:: python | ||
a = "wow, very python" | ||
print("this code should be toggle-able!") | ||
============ | ||
Installation | ||
============ | ||
|
||
You can install `sphinx-togglebutton` with `pip`: | ||
|
||
.. code:: bash | ||
pip install sphinx-togglebutton | ||
===== | ||
Usage | ||
===== | ||
|
||
In your ``conf.py`` configuration file, add ``sphinx_togglebutton`` | ||
to your extensions list. | ||
|
||
E.g.: | ||
|
||
.. code:: python | ||
extensions = [ | ||
... | ||
'sphinx_togglebutton' | ||
... | ||
] | ||
Now, whenever you wish for an admonition to be toggle-able, add the | ||
``:class: toggle`` parameter to the admonition directive that you use. | ||
|
||
For example, this code would create a toggle-able "note" admonition: | ||
|
||
.. code:: rst | ||
.. note:: | ||
:class: toggle | ||
This is my note. | ||
Here's how it looks: | ||
|
||
.. note:: | ||
:class: toggle | ||
|
||
This is my note. | ||
|
||
Clicking on the toggle button will toggle the item's visibility. | ||
|
||
You may also **hide the content by default**. To do so, add the ``toggle`` | ||
class *as well as* a ``toggle-hidden`` class, like so: | ||
|
||
.. code:: rst | ||
.. note:: | ||
:class: toggle, toggle-hidden | ||
This is my note. | ||
This will generate the following block: | ||
|
||
.. note:: | ||
:class: toggle, toggle-hidden | ||
|
||
This is my note. | ||
|
||
You can also use **containers** to add arbitrary toggle-able code. For example, | ||
here's a container with an image inside: | ||
|
||
.. container:: toggle, toggle-hidden | ||
|
||
.. admonition:: Look at that, an image! | ||
|
||
.. image:: https://media.giphy.com/media/mW05nwEyXLP0Y/giphy.gif | ||
|
||
Here's how they look right after one another: | ||
|
||
.. note:: | ||
:class: toggle | ||
|
||
This is my note. | ||
|
||
.. note:: | ||
:class: toggle | ||
|
||
This is my second. |
Oops, something went wrong.