sidebar_links¶
Directive which adds a toctree to the sidebar containing links to the GitHub repository, PyPI project page etc.
New in version 2.9.0.
Enable sphinx_toolbox.sidebar_links by adding the following
to the extensions variable in your conf.py:
extensions = [
...
'sphinx_toolbox.sidebar_links',
]
For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .
Usage¶
- .. sidebar-links::¶
Adds a toctree to the sidebar containing links to the GitHub repository, PyPI project page etc. The toctree is only shown in the sidebar and is hidden with non-HTML builders.
You can see an example of this in the sidebar of this documentation.
Note
This directive can only be used on the root document (i.e. index.rst).
- :github: (flag)¶
Flag to add a link to the project’s GitHub repository.
To use this option add the following to your
conf.py:extensions = [ ... 'sphinx_toolbox.github', ] github_username = '<your username>' github_repository = '<your repository>'
See
sphinx_toolbox.githubfor more information.
- :pypi: (string)¶
Flag to add a link to the project page on PyPI.
The name of the project on PyPI must be passed as the option’s value.
- :caption: (string)¶
The caption of the toctree. Defaults to
Links
Additional toctree entries may be added as the content of the directive, in the same manner as normal toctrees.
API Reference¶
Classes:
|
Directive which adds a toctree to the sidebar containing links to the GitHub repository, PyPI project page etc. |
Functions:
|
Setup |
- class SidebarLinksDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]¶
Bases:
SphinxDirectiveDirective which adds a toctree to the sidebar containing links to the GitHub repository, PyPI project page etc.
Methods:
Process the
:github:flag.run()Create the installation node.
- setup(app)[source]¶
Setup
sphinx_toolbox.sidebar_links.- Parameters
app (
Sphinx) – The Sphinx application.- Return type