Skip to content
Tabbed views for Sphinx
Roff Python JavaScript HTML CSS Makefile
Branch: master
Clone or download
Latest commit 782104f Sep 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Update docs Jun 12, 2019
example
images
sphinx_tabs Merge branch 'mark-as-parallel-safe' of https://github.com/Calinou/sp… Sep 10, 2019
.gitignore
.travis.yml
CHANGES.txt Update changes Sep 10, 2019
LICENSE Fix license year Feb 9, 2017
Makefile pep8 -> pycodestyle Nov 5, 2018
README.md Fix example link Sep 18, 2019
pylint.cfg Fix pep8 and pylint errors Jan 24, 2018
setup.py v1.1.13 Sep 10, 2019

README.md

sphinx-tabs Build Status

Create tabbed content in Sphinx documentation when building HTML.

For example, see the [Raw] code of example/index.rst which generates the following:

A live demo can be found here: https://djungelorm.github.io/sphinx-tabs/

Tabs

Installation

pip install sphinx-tabs

To enable the extension in Sphinx, add the following to your conf.py:

extensions = ['sphinx_tabs.tabs']

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:

https://github.com/djungelorm/sphinx-tabs/releases/download/v1.1.12/sphinx-tabs-1.1.13.tar.gz

An example of this can be found here.

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.

Tabs

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

Group Tabs

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

Code Tabs

You can’t perform that action at this time.