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-2.1.1.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocstrings_python_xref-2.1.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkdocstrings_python_xref-2.1.1.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mkdocstrings_python_xref-2.1.1.tar.gz
Algorithm Hash digest
SHA256 649c2d35dbd766ee8f57706bc2af4b2f1f0090862821e83e58224aa9cad3e589
MD5 8e04465350da2791d1c3aca8ae9ac224
BLAKE2b-256 2ce010cf8e825376622ff584af4274cabfe3781f6b531200220a2280d2d4b071

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkdocstrings_python_xref-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5f4d36cba7ff83e639293d41d76b98554d9ebbe093af6f415b20af0511b9bc4
MD5 b015b69142d3f5e33ea06d5ab791bd74
BLAKE2b-256 b7377263b08d95cae74c5d301d65620619cc2e641c2e4f487597d659dd568c98

See more details on using hashes here.

Supported by

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