Let's considere the following function :
def format_send_event(self, message_identifier, payload=""):
"""
Format a SendEvent.
:param message_identifier: Message identifier (defined in the :py:module:`MyModule.constants` file).
:type message_identifier: int
:param payload: Payload of the message.
:type payload: str
"""
# Do something
When I compile it with sphinx-build, I have the following error :
...MyModule/handlers.py:docstring of MyModule.handlers.MyClass.format_send_event:3: ERROR: Unknown interpreted text role "py:module".
It looks like the sphinx-builder is unable to understand the tag :py:module:
.
What is the tag used for referencing a module in Sphinx ?
To support Markdown-based documentation, Sphinx can use MyST-Parser. MyST-Parser is a Docutils bridge to markdown-it-py, a Python package for parsing the CommonMark Markdown flavor.
According to the documentation, you should use :py:mod:
to cross-reference.
Generally the shorter versions of tags seem to be used to cross-reference, and longer names to document.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With