我正在尝试使用 sphinx 构建文档,但无法弄清楚如何使用:noindex:.
我正在使用以下扩展:
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.autodoc",
"sphinx_rtd_theme",
"m2r2",
]
Run Code Online (Sandbox Code Playgroud)
我的.rst文件包含 autodoc 中用于生成文档的例程:
.. automodule:: squid.models.main_model
:members:
:undoc-members:
:show-inheritance:
Run Code Online (Sandbox Code Playgroud)
这指向main_model.py文件,其中包含:
class MainModel:
... some functions ...
def to(self, device):
"""
:noindex:
Copy of `nn.Module` `to` function but adjusts for stuff.
"""
Run Code Online (Sandbox Code Playgroud)
上面的方法:noindex:不起作用。它只是作为普通文本显示在生成的文档中。
我尝试过这三种放置索引的方法:
# Attempt 1
def to(self, device):
"""
:noindex:
Copy of `nn.Module` `to` function but adjusts for stuff.
"""
# Attempt 2
def to(self, …Run Code Online (Sandbox Code Playgroud)