I am trying to build documentation with sphinx, and cannot figure out how to use :noindex:.
Setup
I'm using following extensions:
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.autodoc",
"sphinx_rtd_theme",
"m2r2",
]
My .rst file contains this routine from autodoc to generate documentation:
.. automodule:: squid.models.main_model
:members:
:undoc-members:
:show-inheritance:
This points to main_model.py file, which contains:
class MainModel:
... some functions ...
def to(self, device):
"""
:noindex:
Copy of `nn.Module` `to` function but adjusts for stuff.
"""
The :noindex: above doesn't work. It just shows up in generated documentation as normal text.
Attempts
I have tried these three ways of putting index:
# Attempt 1
def to(self, device):
"""
:noindex:
Copy of `nn.Module` `to` function but adjusts for stuff.
"""
# Attempt 2
def to(self, device):
"""
.. py:function:: to
:noindex:
Copy of `nn.Module` `to` function but adjusts for stuff.
"""
# Attempt 3
def to(self, device): # :noindex:
"""Copy of `nn.Module` `to` function but adjusts for stuff.
"""
But neither worked.
Am I missing something obvious, or is :noindex: not supposed to be used outside of .rst files? If that's the case then is there any way I can still leverage autodoc, in this case without explicitly defining MainModel and to functions in .rst?