sphinx-toolbox Logo
2.14.1
  • 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-2021 Dominic Davis-Foster Revision 4d82301c .

Built with Sphinx 4.0.3 using a theme provided by Read the Docs. Show Source.