I'm trying to improve the structure of the documentation of my python modules.
Right now I have an Sphinx index.rst
file that looks like this:
Contents:
.. toctree::
:maxdepth: 3
.. automodule:: myModule1
:members:
.. automodule:: myModule2
:members:
etc. This produces a HTML page that contains a long chaotic list of all my documented functions. This means that the documentation is easier to read in code, than in its HTML output.
The first improvement is easy: I can add titles and descriptions to the start of each model, so that the visual separation of modules becomes clearer in the html output. So like this:
"""
##############################################
myModule1 Title
##############################################
Description of myModule1.
"""
etc. But now I'd like to take this one step further by separating my modules into sections that have their own section titles and descriptions that belong to a subset of the module's functions. I tried the following:
"""
##############################################
myModule1 Title
##############################################
Description of myModule1.
"""
... # meaning import statements etc
"""
**********************************************
First Section title
**********************************************
Some descriptive text
"""
def myFunction1()
""" function doc """
... # meaning the actual function implementation
def myFunction2()
""" function doc """
... # meaning the actual function implementation
"""
**********************************************
Second Section title
**********************************************
Some descriptive text
"""
def myFunction3()
""" function doc """
... # meaning the actual function implementation
def myFunction4()
""" function doc """
... # meaning the actual function implementation
But this leads to a:
'SEVERE: Unexpected section title or transition.'
error when running make HTML
.
So how can I get the desired structure without moving documentation away from the code it documents?