[英]Python module reference with Sphinx documentation
讓我們考慮以下功能:
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
當我用 sphinx-build 編譯它時,出現以下錯誤:
...MyModule/handlers.py:docstring of MyModule.handlers.MyClass.format_send_event:3: ERROR: Unknown interpreted text role "py:module".
看起來 sphinx-builder 無法理解標簽:py:module:
。
在 Sphinx 中用於引用模塊的標簽是什么?
根據文檔,您應該使用:py:mod:
進行交叉引用。
通常,較短版本的標簽似乎用於交叉引用,而較長的名稱用於文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.