sphinx-toolbox Logo
3.4.0
  • Home

Extensions

  • Overview
  • assets
  • changeset
  • code
  • collapse
  • confval
  • decorators
  • documentation_summary
  • flake8
  • formatting
  • github
  • installation
  • issues
  • latex
  • pre_commit
  • rest_example
  • shields
  • sidebar_links
    • Usage
      • .. sidebar-links::
    • API Reference
      • SidebarLinksDirective
      • setup
  • source
  • wikipedia
  • more_autodoc
  • more_autosummary
  • tweaks
  • Changelog

Developer API

  • sphinx_toolbox
  • sphinx_toolbox.config
  • sphinx_toolbox.testing
  • sphinx_toolbox.utils

Links

  • GitHub
  • PyPI
  • Contributing Guide
  • Downloading source code
  • License
sphinx-toolbox
  • Docs »
  • sidebar_links
  • Edit on GitHub

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.github for 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:

SidebarLinksDirective(name, arguments, …)

Directive which adds a toctree to the sidebar containing links to the GitHub repository, PyPI project page etc.

Functions:

setup(app)

Setup sphinx_toolbox.sidebar_links.

class SidebarLinksDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]¶

Bases: SphinxDirective

Directive which adds a toctree to the sidebar containing links to the GitHub repository, PyPI project page etc.

Methods:

process_github_option()

Process the :github: flag.

run()

Create the installation node.

process_github_option()[source]¶

Process the :github: flag.

Return type

str

run()[source]¶

Create the installation node.

Return type

List[Node]

setup(app)[source]¶

Setup sphinx_toolbox.sidebar_links.

Parameters

app (Sphinx) – The Sphinx application.

Return type

SphinxExtMetadata

Next Previous

© Copyright 2020-2022 Dominic Davis-Foster Revision 8ad046b1 .

Built with Sphinx 3.5.4 using a theme provided by Read the Docs. Show Source.
Read the Docs v: latest
Versions
latest
stable
v3.4.0
v3.3.0
v3.2.0
v3.1.2
v3.1.1
v3.1.0
v3.0.0
v2.18.3
v2.18.2
v2.18.1
v2.18.0
2.18.x
v2.17.0
v2.16.1
v2.16.0
v2.15.3
v2.15.2
v2.15.1
v2.15.0
v2.14.1
v2.13.x
Downloads
pdf
html
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.