Skip to main content

Enhanced mkdocstrings python handler

Project description

mkdocstrings-python-xref

Python handler for mkdocstrings supporting relative cross-references.

pypi version conda version documentation
PyPI - Python Version GitHub
CI GitHub issues

mkdocstrings is an awesome plugin for MkDocs that can generate Markdown API documentation from comments in code. The standard python handler allows you to create cross-reference links using the syntax [<title>][<path>] where the path must either be the fully qualified name of the referent or is empty, in which case the path is taken from the title. This works well when the names are short, but can be burdensome in larger codebases with deeply nested package structures.

This package extends mkdocstrings-python to support a relative cross-reference syntax, that allows you to write doc-strings with cross-references like:

class MyClass:
    def this_method(self):
        """
        See [other_method][..] from [MyClass][(c)]
        """

rather than:

class MyClass:
    def this_method(self):
        """
        See [other_method][mypkg.mymod.MyClass.other_method] 
        from [MyClass][mypkg.mymod.Myclass]
        """

Another benefit of this extension is that it will report source locations for bad references so that errors are easier to find and fix. For example:

$ mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /home/jdoe/my-project/site
WARNING -  mkdocstrings_handlers: file:///home/jdoe/my-project/src/myproj/bar.py:16:
           Cannot load reference 'myproj.bar.bad'

For further details, please see the Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocstrings_python_xref-1.6.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

mkdocstrings_python_xref-1.6.2-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file mkdocstrings_python_xref-1.6.2.tar.gz.

File metadata

File hashes

Hashes for mkdocstrings_python_xref-1.6.2.tar.gz
Algorithm Hash digest
SHA256 65e83fecc3a059d173aab9b06e4bcd50cc720b221b3cc3d6b35b11ffb6aa86d4
MD5 a94ff40332cc08caac3dabd2810a7b49
BLAKE2b-256 75793ee49ca07b55eb9d25fcfa38a3905cdc03af02cce5513f7a458e8211d5a9

See more details on using hashes here.

File details

Details for the file mkdocstrings_python_xref-1.6.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocstrings_python_xref-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1492b822bcb04a9072a9b731ceabfed4b9d3f8cd23c62211cb8b22bab0cb7fc0
MD5 3d2f607209243f52272b0a86b044510b
BLAKE2b-256 70e0dd595c056920b1cbdfd1af4372f5fc49f5fb4252072d9a07e1634146a8d1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page