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
  • source
  • wikipedia
  • more_autodoc
    • more_autodoc.augment_defaults
    • more_autodoc.autonamedtuple
    • more_autodoc.autoprotocol
    • more_autodoc.autotypeddict
    • more_autodoc.generic_bases
    • more_autodoc.genericalias
    • more_autodoc.no_docstring
    • more_autodoc.overloads
    • more_autodoc.regex
    • more_autodoc.sourcelink
      • Configuration
        • autodoc_show_sourcelink
      • API Reference
        • sourcelinks_process_docstring
        • setup
    • more_autodoc.typehints
    • more_autodoc.typevars
    • more_autodoc.variables
    • setup
  • 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 »
  • more_autodoc »
  • more_autodoc.sourcelink
  • Edit on GitHub

more_autodoc.sourcelink¶

Source code: sphinx_toolbox/more_autodoc/sourcelink.py


Show a link to the corresponding source code at the top of automodule output.

New in version 0.6.0.

Enable sphinx_toolbox.more_autodoc.sourcelink by adding the following to the extensions variable in your conf.py:

extensions = [
    ...
    'sphinx_toolbox.more_autodoc.sourcelink',
    ]

For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .

Configuration¶

sphinx_toolbox.more_autodoc.sourcelink can be configured using the autodoc_default_options option in conf.py, or with the :sourcelink: option flag to automodule.

autodoc_show_sourcelink¶
Type: bool
Default: False

If True, shows a link to the corresponding source code at the top of each automodule directive.

:sourcelink:¶

When passed as an option flag to an automodule directive, show a link to the corresponding source code at the top of the output for that module only.

Changed in version 1.1.0: Added support for the :sourcelink: option flag to automodule.

API Reference¶

Functions:

sourcelinks_process_docstring(app, what, …)

Process the docstring of a module and add a link to the source code if given in the configuration.

setup(app)

Setup sphinx_toolbox.more_autodoc.sourcelink.

sourcelinks_process_docstring(app, what, name, obj, options, lines)[source]¶

Process the docstring of a module and add a link to the source code if given in the configuration.

Parameters
  • app (Sphinx) – The Sphinx application.

  • what

  • name (str) – The name of the object being documented.

  • obj – The object being documented.

  • options (Mapping[str, Any]) – Mapping of autodoc options to values.

  • lines (List[str]) – List of strings representing the current contents of the docstring.

setup(app)[source]¶

Setup sphinx_toolbox.more_autodoc.sourcelink.

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.