Sphinx Bootstrap Theme

The Sphinx Bootstrap Theme is an extension for the Sphinx documentation tool, used for Python-based API documentation and static website authoring. The theme integrates Twitter Bootstrap, which is a wildly popular frontend framework. The theme GitHub project provides a demonstration site using the theme.

The theme project continues to move along, and as it has been a while since my last update post, here are some of the changes in version 0.1.6 (since 0.1.0):

  • Update to Bootstrap v2.3.0.
  • Enable configuration of the depth of the Global TOC (“Site” tab).
  • Add footer divider and various other styling tweaks.
  • Add Bootstrap styling for tables and inline code snippets

In addition, much of the underlying rendering JavaScript code has been revised. For example, Twitter Bootstrap v2.3.0 handles behavior like dropdown menu clicks in mobile much better than previous versions, enabling removal of some hacks and patches in the theme.

Theme Options

Here is the current list of options you can set for the theme in the “conf.py” configuration file, as used by the demo site in “conf.py”:

html_theme_options = {
    # Global TOC depth for "site" navbar tab. (Default: 1)
    # Switching to -1 shows all levels.
    'globaltoc_depth': 2,

    # HTML navbar class (Default: "navbar") to attach to <div> element.
    # For black navbar, do "navbar navbar-inverse"
    'navbar_class': "navbar navbar-inverse",

    # Fix navigation bar to top of page?
    # Values: "true" (default) or "false"
    'navbar_fixed_top': "true",

    # Location of link to source.
    # Options are "nav" (default), "footer" or anything else to exclude.
    'source_link_position': "nav",
}