Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
choldgraf committed Jan 8, 2020
1 parent 8e70081 commit 16addfc
Show file tree
Hide file tree
Showing 40 changed files with 15,495 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Chris Holdgraf
Copyright (c) 2018 Chris Holdgraf

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
graft doc/
67 changes: 67 additions & 0 deletions README.rst
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
29 changes: 29 additions & 0 deletions RELEASES.md
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!
```
20 changes: 20 additions & 0 deletions doc/Makefile
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 added doc/_build/doctrees/environment.pickle
Binary file not shown.
Binary file added doc/_build/doctrees/index.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions doc/_build/html/.buildinfo
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
115 changes: 115 additions & 0 deletions doc/_build/html/_sources/index.rst.txt
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.

0 comments on commit 16addfc

Please sign in to comment.