-
Is it possible to use reference-style links in a python docstring when using mkdocstrings? I tried the following example: 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:
Args:
param1 (int): The first parameter.
param2 (str): The second parameter.
Returns:
(bool): The return value. True for success, False otherwise.
[1]: https://www.python.org/dev/peps/pep-0484/
""" The first link ( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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 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.python.org/dev/peps/pep-0484/
Args:
param1 (int): The first parameter.
param2 (str): The second parameter.
Returns:
(bool): The return value. True for success, False otherwise.
""" |
Beta Was this translation helpful? Give feedback.
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: