Skip to content

Are reference-style links supported in python docstrings? #178

Answered by pawamoy
cdwilson asked this question in Q&A
Discussion options

You must be logged in to vote

Since this is a Google-style docstring, and I suppose mkdocstrings-python/Griffe was configured to parse it as such, the blocks of text are converted from Markdown to HTML separately, which explains why the reference [1] fails.

To fix this, you must put the reference link in the same text block as where it's referenced:

def function_with_types_in_docstring(param1, param2):
    """Example function with types documented in the docstring.

    [PEP 484](https://www.python.org/dev/peps/pep-0484/) type
    annotations are supported. If attribute, parameter, and return types
    are annotated according to [PEP 484][1], they do not need to be
    included in the docstring:

    [1]: https://www…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cdwilson
Comment options

Answer selected by cdwilson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
docs Improvements or additions to documentation
2 participants