Skip to main content

Material sphinx theme

Project description

Continuous Integration

Travis Build Status

Release

PyPI Status

License

MIT License

A Material Design theme for Sphinx documentation. Based on Material for MkDocs, and Guzzle Sphinx Theme.

See the theme’s demonstration site for examples of rendered rst.

Installation

Install via pip:

$ pip install sphinx-material

or if you have the code checked out locally:

$ python setup.py install

Configuration

Add the following to your conf.py:

html_theme = 'sphinx_material'

There are a lot more ways to customize this theme, as this more comprehensive example shows:

# Required theme setup
html_theme = 'sphinx_material'

# Material theme options (see theme.conf for more information)
html_theme_options = {

    # Set the name of the project to appear in the navigation.
    'nav_title': 'Project Name',

    # Set you GA account ID to enable tracking
    'google_analytics_account': 'UA-XXXXX',

    # Specify a base_url used to generate sitemap.xml. If not
    # specified, then no sitemap will be built.
    'base_url': 'https://project.github.io/project',

    # Set the color and the accent color
    'color_primary': 'blue',
    'color_accent': 'light-blue',

    # Set the repo location to get a badge with stats
    'repo_url': 'https://github.com/project/project/',
    'repo_name': 'Project',

    # Visible levels of the global TOC; -1 means unlimited
    'globaltoc_depth': 3,
    # If False, expand all TOC entries
    'globaltoc_collapse': False,
    # If True, show hidden TOC entries
    'globaltoc_includehidden': False,
}

Customizing the layout

You can customize the theme by overriding Jinja template blocks. For example, ‘layout.html’ contains several blocks that can be overridden or extended.

Place a ‘layout.html’ file in your project’s ‘/_templates’ directory.

mkdir source/_templates
touch source/_templates/layout.html

Then, configure your ‘conf.py’:

templates_path = ['_templates']

Finally, edit your override file ‘source/_templates/layout.html’:

{# Import the theme's layout. #}
{% extends '!layout.html' %}

{%- block extrahead %}
{# Add custom things to the head HTML tag #}
{# Call the parent block #}
{{ super() }}
{%- endblock %}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_material-0.0.30.tar.gz (778.4 kB view details)

Uploaded Source

Built Distribution

sphinx_material-0.0.30-py3-none-any.whl (786.9 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_material-0.0.30.tar.gz.

File metadata

  • Download URL: sphinx_material-0.0.30.tar.gz
  • Upload date:
  • Size: 778.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for sphinx_material-0.0.30.tar.gz
Algorithm Hash digest
SHA256 a12864f832d792fd445e920c61c82f3c51233eaa652741d91bb20d7c38ab2a82
MD5 5e545b350dc5daca6708237c9a37bd90
BLAKE2b-256 95b05bdcfb18437ae79c5785d64689a59cc8f0edff66698f8f2f5db92d13121d

See more details on using hashes here.

File details

Details for the file sphinx_material-0.0.30-py3-none-any.whl.

File metadata

  • Download URL: sphinx_material-0.0.30-py3-none-any.whl
  • Upload date:
  • Size: 786.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for sphinx_material-0.0.30-py3-none-any.whl
Algorithm Hash digest
SHA256 12e5a5fc8b3f7718d4f5168d12680fb87c2abb2a5f250dcd547de18c41e4ae82
MD5 0917e4e6879e01d2230d5cc57299d635
BLAKE2b-256 71f28b79298b708bd6268202f3b782f3e248b9220b0382656be54b32374c6763

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page