sphinx: list of classes

If you’re not using autodoc, building a list of all your documented classes is not that straightforward. Unfortunately, sphinx does not offer any method to embed this list into your documentation. Below, you find a snippet that creates a sorted list of all classes. Here is what the result looks like:


Put this code into a file called “foobar.py” in your sphinx directory and add the “foobar” plugin to your configuration. You can add a classlist to any page by using the ..classlist:: directive or add this snippet as “classlist.html” to your template directory and add the alphabetically sorted list to your sidebar.

Leave a comment

Your email address will not be published.