Example: API¶
You can include automatically generated API documentation
from the doctsrings of your modules and functions.
To provide this functionality
you have to add the sphinx.ext.autodoc to your docs/conf.py file:
extensions = [
'sphinx.ext.autodoc',
]
With sphinx.ext.autodoc you can automatically include the docstring of a module and all its members with the automodule directive, e.g.
.. automodule:: sphinx.theming
:members:
If you prefer to include only parts of that module and add headers yourself you could use:
Theme
-----
.. autoclass:: sphinx.theming.Theme
:members:
extract_zip
-----------
.. autofunction:: sphinx.theming.extract_zip
Which results in:
Theme¶
- class sphinx.theming.Theme(name: str, *, configs: dict[str, _ConfigFile], paths: list[str], tmp_dirs: list[str])¶
A Theme is a set of HTML templates and configurations.
This class supports both theme directory and theme archive (zipped theme).
- get_config(section: str, name: str, default: ~typing.Any = <object object>) Any¶
Return the value for a theme configuration setting, searching the base theme chain.
- get_options(overrides: dict[str, Any] | None = None) dict[str, Any]¶
Return a dictionary of theme options and their values.
- get_theme_dirs() list[str]¶
Return a list of theme directories, beginning with this theme’s, then the base theme’s, then that one’s base theme’s, etc.