Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f51d73491e
Fetching contributors…

Cannot retrieve contributors at this time

93 lines (68 sloc) 3.326 kb

Sphinx Bootstrap Theme

This repository integrates the Twitter Bootstrap CSS / JavaScript framework as a Sphinx theme. A live demo is available to preview the theme.

Installation

To install the theme, download the theme directory and update your configuration

  1. Create a "_themes" directory in your project source root.

  2. Get the "bootstrap" themes either as raw files or as a zipfile from the repository.

    1. Most current way is to just clone this repo or download the full repo source and move the "bootstrap" directory to "_themes".

    2. Alternatively, there are some prepackaged theme zip files (containing only the theme files), which can be read directly by Sphinx. See the repo downloads page for available packages. Then download "bootstrap.zip":

      $ cd /path/to/_themes
      $ wget https://github.com/downloads/ryan-roemer/sphinx-bootstrap-theme/bootstrap.zip
      

      Note

      The zipfiles have a hash indicating build origin. The "bootstrap.zip" is a copy of the most recent hashed build. If you do get an older hash-named zipfile, you must rename it to the theme name ("bootstrap.zip") for Sphinx to properly pick it up.

  3. Edit your configuration file to point to the bootstrap theme:

    # Activate the theme.
    sys.path.append(os.path.abspath('_themes'))
    html_theme_path = ['_themes']
    html_theme = 'bootstrap'
    
    # (Optional) Use a shorter name to conserve nav. bar space.
    html_short_title = "Demo"
    
    # (Optional) Logo. Should be exactly 32x32 px to fit the nav. bar.
    # Path should be relative to the html_static_path setting (e.g.,
    # "_static") in source.
    html_logo = "my_logo.png"
    

Theme Notes

Sphinx

The theme places the global TOC, local TOC, navigation (prev, next) and source links all in the top Bootstrap navigation bar, along with the Sphinx search bar on the left side.

The global (site-wide) table of contents is the "Site" navigation dropdown, which is a multi-level deep rendering of the toctree for the entire site. The local (page-level) table of contents is the "Page" navigation dropdown, which is a multi-level rendering of the current page's toc.

Generally speaking, this is a quick and dirty hack to get the basic theme going, so there are likely some oversights and lurking issues. Help and bug filings for the project are most welcome.

Bootstrap

The theme uses the following files from Twitter Bootstrap v1.4.0:

bootstrap-dropdown.js
bootstrap-scrollspy.js
bootstrap.css

You can drop different versions in your Sphinx "_static" directory to override these files.

Licenses

Sphinx Bootstrap Theme is licensed under the MIT license.

Twitter Bootstrap is licensed under the Apache license.

Jump to Line
Something went wrong with that request. Please try again.