Tabbed views for Sphinx
Project description
sphinx-tabs
Create tabbed content in Sphinx documentation when building HTML.
For example, see the [Raw] code of docs/index.rst which generates the following:
A live demo can be found here: https://sphinx-tabs.readthedocs.io
Installation
pip install sphinx-tabs
To enable the extension in Sphinx, add the following to your conf.py:
extensions = ['sphinx_tabs.tabs']
If needed, there is a configuration option to allow additional builders to be considered compatible. For example, to add the linkcheck
builder, add the following to your conf.py:
sphinx_tabs_valid_builders = ['linkcheck']
If you are using Read The Docs for building your documentation, the extension must be added as a requirement. Please add the following to requirements.txt
at the root of the project:
sphinx-tabs
Contributing
We welcome all contributions! See the EBP Contributing Guide for general details.
The simplest way to run tests is to install pre-commit for linting and tox for unit tests and documentation build:
$ pre-commit run --all
$ tox -p
Basic Tabs
Basic tabs can be coded as follows:
.. tabs::
.. tab:: Apples
Apples are green, or sometimes red.
.. tab:: Pears
Pears are green.
.. tab:: Oranges
Oranges are orange.
Grouped Tabs
Tabs can be grouped, so that changing the current tab in one area changes the current tab in the another area. For example:
.. tabs::
.. group-tab:: Linux
Linux Line 1
.. group-tab:: Mac OSX
Mac OSX Line 1
.. group-tab:: Windows
Windows Line 1
.. tabs::
.. group-tab:: Linux
Linux Line 1
.. group-tab:: Mac OSX
Mac OSX Line 1
.. group-tab:: Windows
Windows Line 1
Code Tabs
Tabs containing code areas with syntax highlighting can be created as follows:
.. tabs::
.. code-tab:: c
int main(const int argc, const char **argv) {
return 0;
}
.. code-tab:: c++
int main(const int argc, const char **argv) {
return 0;
}
.. code-tab:: py
def main():
return
.. code-tab:: java
class Main {
public static void main(String[] args) {
}
}
.. code-tab:: julia
function main()
end
.. code-tab:: fortran
PROGRAM main
END PROGRAM main
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sphinx-tabs-1.2.1.tar.gz
.
File metadata
- Download URL: sphinx-tabs-1.2.1.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2df2fcfa216b52cc6f1fbb411fd6cd87abfc7d4704e49bff25f0b5e3e72ae7ae |
|
MD5 | bfdca8fde47c30e08b3c0b9f62828033 |
|
BLAKE2b-256 | d32f03b8060541b2c65b7bdaad75c13dc329248dc5a8ea0ec87d52843ace9dc8 |
Provenance
File details
Details for the file sphinx_tabs-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: sphinx_tabs-1.2.1-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c991b5f4e0727b9cf01ef6c306eba085be3cf941c356e2338552be90109af4a7 |
|
MD5 | f61d34cc15f47126df221411e0aa2cdc |
|
BLAKE2b-256 | c2a1f821e581757db0b0c73720f2faebb54b6421d46e35f0556ccfc05cec9345 |