Sphinx extension for adding alternative code-blocks as selectable tabs
Project description
This is a Sphinx extension that adds a directive code-tabs that creates a navbar above several alternative code blocks, allowing the user to switch between them.
Installation
pip install sphinx_code_tabs
To enable the extension in sphinx, simply add the package name in your conf.py to the list of extensions:
extensions = [
...
'sphinx_code_tabs',
]
Usage
The code-tabs directive declares a notebook of code block alternatives. The individual tabs must be created with the code-tab directive which derives from code-block and accepts all of its arguments.
For example:
.. code-tabs::
.. code-tab:: bash
:title: bash
echo "Hello, World!"
.. code-tab:: c
:title: C/C++
:emphasize-lines: 2
#include <stdio.h>
int main() { printf("Hello, world!\n"); }
.. code-tab:: python
:title: python
print("Hello, world!")
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
sphinx_code_tabs-0.0.1.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for sphinx_code_tabs-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eda9562f3a7636ec3e71d0b422455dffcf13ac152d43f57455d398ba353c9f20 |
|
MD5 | ae3c29019a85c8bc4d943beb615a3576 |
|
BLAKE2b-256 | 822580b99b9fde5d7d0e1916ca913b0886e6666cb67311cbe7007daa58a320e1 |