| 1 |
=================================================================================== |
| 2 |
:mod:`cloud_sptheme.ext.autodoc_sections` - support for ReST sections in docstrings |
| 3 |
=================================================================================== |
| 4 |
|
| 5 |
.. module:: cloud_sptheme.ext.autodoc_sections |
| 6 |
:synopsis: support for ReST sections in docstrings |
| 7 |
|
| 8 |
.. versionchanged:: 1.7 |
| 9 |
|
| 10 |
Drastically revamped how extension works, as well as the DOM / css styles it generates. |
| 11 |
Themes relying on the previous output structure may need to be updated (the css classes were changed, |
| 12 |
to allow simulatenous styling of both old and new versions). |
| 13 |
|
| 14 |
Overview |
| 15 |
======== |
| 16 |
This Sphinx extension should be used in conjunction with the Autodoc extension. |
| 17 |
This extension allows docstrings (module, class, function, etc) to include |
| 18 |
ReST-style section headers (which normally cause problems if integrated |
| 19 |
into Sphinx documentation via Autodoc). |
| 20 |
|
| 21 |
Internals |
| 22 |
========= |
| 23 |
This extension does an *extensive* amount of monkeypatching within Sphinx |
| 24 |
and Docutils. While this allows it to leverage Docutil's native RST parser |
| 25 |
(rather than implement it's own), this does mean it may be more fragile |
| 26 |
if any of the internals change. Please report any bugs. |
| 27 |
|
| 28 |
In order for Sphinx themes (like this one) to distinguish document-level sections |
| 29 |
from the special object-description sections generated by this extension, it assigns |
| 30 |
two extra css classes to the sections it generates: ``desc-section`` and :samp:`desc-section-{level}`. |
| 31 |
Additionally, the header element of each section is assigned the css class ``section-header``. |
| 32 |
Depending on the theme, these may require additional styling rules. |
| 33 |
|
| 34 |
.. todo:: |
| 35 |
|
| 36 |
This extension has a few things which could be improved: |
| 37 |
|
| 38 |
* Subsections should be included in Sphinx's indexing. |
| 39 |
|