跳转到主要内容

基于Material的Sphinx主题

项目描述

连续集成

Travis Build Status

发布

PyPI Status

许可证

MIT License

Sphinx文档的Material设计主题。基于Material for MkDocsGuzzle Sphinx Theme

请参阅主题的演示网站,以查看渲染后的rst示例。

安装

通过pip安装

$ pip install sphinx-material

或者如果您已经在本地检出代码

$ python setup.py install

配置

将以下内容添加到您的conf.py中

html_theme = 'sphinx_material'

如此更全面的示例所示,还有许多其他方法可以自定义此主题

# Required theme setup
html_theme = 'sphinx_material'

# Set link name generated in the top bar.
html_title = 'Project Title'

# 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,
}

自定义布局

您可以通过覆盖Jinja模板块来自定义主题。例如,'layout.html' 包含多个可以覆盖或扩展的块。

在您的项目的 '_templates' 目录中放置一个 'layout.html' 文件。

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

然后,配置您的 'conf.py'

templates_path = ['_templates']

最后,编辑您的覆盖文件 '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 %}

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

sphinx_material-0.0.36.tar.gz (783.7 kB 查看散列值)

上传时间 源代码

构建分发

sphinx_material-0.0.36-py3-none-any.whl (790.4 kB 查看散列值)

上传时间 Python 3

由以下支持