Skip to content

ionelmc/sphinx-py3doc-enhanced-theme

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
ci
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Overview

docs Documentation Status
tests
Travis-CI Build Status Requirements Status

demo default, bare
package

A theme based on the theme of https://docs.python.org/3/ with some responsive enhancements.

  • Free software: BSD 2-Clause License

Installation

pip install sphinx_py3doc_enhanced_theme

Add this in your documentation's conf.py:

import sphinx_py3doc_enhanced_theme
html_theme = "sphinx_py3doc_enhanced_theme"
html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path()]

Customization

No extra styling

This theme has some extra styling like different fonts, text shadows for headings, slightly different styling for inline code and code blocks.

To get the original styling Python 3 docs have add this in you conf.py:

html_theme_options = {
    'githuburl': 'https://github.com/ionelmc/sphinx-py3doc-enhanced-theme/',
    'bodyfont': '"Lucida Grande",Arial,sans-serif',
    'headfont': '"Lucida Grande",Arial,sans-serif',
    'codefont': 'monospace,sans-serif',
    'linkcolor': '#0072AA',
    'visitedlinkcolor': '#6363bb',
    'extrastyling': False,
}
pygments_style = 'friendly'

Custom favicon

To have a custom favicon create a theme directory near your conf.py and add this theme.conf in it:

[theme]
inherit = sphinx_py3doc_enhanced_theme

Then create a favicon.png in the static directory.

And then edit your conf.py to have something like this:

import sphinx_py3doc_enhanced_theme
html_theme = "theme"
html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path(), "."]

The final file structure should be like this:

docs
├── conf.py
└── theme
    ├── static
    │   └── favicon.png
    └── theme.conf

A bit of extra css

html_theme_options = {
    'appendcss': 'div.body code.descclassname { display: none }',
}

Examples