0

Is it possible to create an index in Sphinx which is created by specific (or custom) elements in the docstring?

For example, I have the following function and would like to have Sphinx to create an index from the field "Command Reference".

Is this possible and what would I have to do?

def get_software_version(self):
    """
    Gets the software version 

    Examples
    --------
    100000 = V1.00 

    Command Reference
    -----------------
    CSWVE

    Returns
    -------
    version: string
       version number as string
    """
MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
sven
  • 11
  • 3
  • 1
    No. However you can use [sphinx-quickstart](http://www.sphinx-doc.org/en/master/usage/quickstart.html) to generate the initial index.rst file or [sphinx-apidoc](http://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html) for automatic generation of Sphinx sources that, using the autodoc extension, document a whole package in the style of other automatic API documentation tools. – Steve Piercy Jul 13 '18 at 10:39
  • If you mean "create an index **entry**", take a look at http://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#index-generating-markup – mzjn Jul 13 '18 at 11:56
  • It is not clear what "create Sphinx index from a specific or custom docstring element" means. – mzjn Nov 29 '21 at 13:07

0 Answers0