Category "docutils"

Getting "Extension error (sphinx.environment.collectors.toctree)" when adding section nodes in Sphinx extension

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

Specifying anchor names in reST

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,