材质狮身人面像主题

sphinx-material的Python项目详细描述


连续集成

Travis Build Status

发布

PyPI Status

许可证

MIT License

狮身人面像文件的材料设计主题。基于 Material for MkDocs, 以及Guzzle Sphinx Theme

查看主题的demonstration site 例如渲染的rst。

安装

通过PIP安装:

$ pip install git+https://github.com/bashtage/sphinx-material

或者如果您已在本地签出代码:

$ python setup.py install

配置

在conf.py中添加以下内容:

importsphinx_material# Register the theme as an extension to generate a sitemap.xmlextensions.append('sphinx_material')# Choose the material themehtml_theme='sphinx_material'# Get the them pathhtml_theme_path=sphinx_material.html_theme_path()# Register the required helpers for the html contexthtml_context=sphinx_material.get_html_context()

有很多方法可以定制这个主题,因为它更加全面 示例显示:

importsphinx_material# Required theme setupextensions.append('sphinx_material')html_theme='sphinx_material'html_theme_path=sphinx_material.html_theme_path()html_context=sphinx_material.get_html_context()# Material theme options (see theme.conf for more information)html_theme_options={# Set the name of the project to appear in the navigation.'nav_name':'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”包含几个可以重写或扩展的块。

将“layout.html”文件放在项目的“/\u templates”目录中。

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

然后,配置“conf.py”:

templates_path=['_templates']

最后,编辑覆盖文件“source/u 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 %}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么会出现这些错误?表达式的非法开始   使用HttpUrlConnection的java测试URL仅适用于前面的www   在大数据集上使用kmeans的java堆外内存   查找Java RandomAccessFile如何以字符形式读取第n个字节   java Android从BroadcastReceiver获取标题和描述   java使用构造函数参数模拟嵌套类并测试方法   正在将Azure Blob项强制转换为Java文件对象   java并行运行testNG套件   java程序在运行时似乎没有进入   贬低Java规则引擎的优点和缺点   文本区域中的java中心文本   java JPA从多个表中选择错误   类Java问题使用类加载器重新加载代码   java如何在Spring非管理类上使用@Value   java(关闭)Gradle导入VS代码失败   java arraylist拆分(“空白”)并计算字数   Android/Java如何在单独的*中调用函数。java文件?   具有基本身份验证的java Apache Camel RSS模块   java为什么程序在出现溢出或下溢时不抛出异常