sphinx – how to change documentation style sheet

Question:

I generated the Python documentation with sphinx to view it on Qt Assistant, but the theme used by the Python developers for their documentation seems to have some problems on Qt Assistant, Is there a way to override/change the theme before generating the documentation?

enter image description here

Thanks!

P.S.: I followed some indications from here http://docs.python.org/devguide/documenting.html#using-make-make-bat but instead of doing make html I did sphinx-build -b qthelp . build/qthelp and later qcollectiongenerator-qt4 build/qthelp/Python.qhcp. I used sphinx 1.1.3.

Asked By: shackra

||

Answers:

Theming in Sphinx is easily done. Just find the theme you want to modify in your Sphinx package directory or chose something in the variety of themes on Internet. What you need to do is to put the theme to some folder (for example _themes) and add this folder to your conf.py. There should be a line for theme path in your conf.py by default. Now use the name of your theme in the conf.py under html_theme.

It should do the trick.

Most standard themes are based on basic theme and inherit most of its classes. You may consider using this theme as a sandbox as it contains most stuff explicitly, without inheritance mess.

Also I couldn’t help noticing your custom builder. Custom builder may be the problem here too. HTML theming in Sphinx would work best with the stock HTML builder. However the basic theme could probably work better with your workflow, as it is stripped off the eye candy.

Answered By: wswld

This was a bug on Python documentation that is now fixed 🙂 see http://hg.python.org/cpython/rev/2a6c33592e40 and http://hg.python.org/cpython/rev/d6831d94dd1e

Answered By: shackra