I am trying to write a new Sphinx extension. A minimum example of an extension that does something similar to what I want is from docutils import nodes from doc
I'm creating HTML from reST using the rst2html tool which comes with docutils. It seems that the code already assigns id attributes to the individual sections,