Adaptation of mkdocs-material theme for the Sphinx documentation system
Project description
This theme is an adaptation of the popular mkdocs-material theme for the Sphinx documentation tool.
This theme is regularly maintained to stay up to date with the upstream mkdocs-material repository. The HTML templates, JavaScript, and styles from the mkdocs-material theme are incoroprated directly with mostly minor modifications.
This theme is a fork of the sphinx-material theme, which proved the concept of a Sphinx theme based on an earlier version of the mkdocs-material theme, but has now significantly diverged from the upstream mkdocs-material repository.
See the TensorStore documentation for a demonstration of this theme.
WARNING: This theme is currently still a work in progress. The documentation is largely copied from sphinx-material and is inaccurate for this version. It does not yet integrate well with numpydoc or the built-in autosummary.
Installation
Install via pip:
$ pip install sphinx-immaterial
or if you have the code checked out locally:
$ pip -install -e .
Configuration
In your conf.py add sphinx_immaterial as an extension:
extensions = [
...,
"sphinx_immaterial"
]
and add the following:
html_theme = 'sphinx_immaterial'
to set the theme.
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 %}
Differences from mkdocs-material
This theme closely follows the upstream mkdocs-material repository, but there are a few differences, primarily due to differences between Sphinx and MkDocs:
This theme adds styles for Sphinx object descriptions, commonly used for API documentation (e.g. class and function documentation). This is a core element of Sphinx for which there is no corresponding feature in MkDocs.
mkdocs-material uses lunr.js for searching, and has custom UI components for displaying search results in a drop-down menu as you type the search query. This theme uses a separate search implementation based on the custom index format used by Sphinx, which fully integrates with the search UI provided by mkdocs-material.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file sphinx_immaterial-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: sphinx_immaterial-0.3.1-py3-none-any.whl
- Upload date:
- Size: 4.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e3422ae36b1484600b8d501847725480e612f05b045cdc5f29914154136d39f |
|
MD5 | 10c053e277ec0cd92670c7c59af039b0 |
|
BLAKE2b-256 | af6ccfd95a6cd4e7854c1e5cd0419f9c618fbe1ab389e98a012308831be2eefb |