梅茜用的狮身人面像

Maisie-Sphinx-Theme的Python项目详细描述


梅西使用的狮身人面像主题:https://docs.maisie.dev
基于guzzle主题:http://guzzlephp.org

安装

通过PIP安装:

$ pip install Maisie-Sphinx-Theme

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

$ python setup.py install

配置

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

importmaisie_sphinx_themehtml_theme_path=maisie_sphinx_theme.html_theme_path()html_theme='maisie_sphinx_theme'# Register the theme as an extension to generate a sitemap.xmlextensions.append("maisie_sphinx_theme")# Maisie theme options (see theme.conf for more information)html_theme_options={# Set the name of the project to appear in the sidebar"project_nav_name":"Project Name",}

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

importmaisie_sphinx_themehtml_theme_path=maisie_sphinx_theme.html_theme_path()html_theme='maisie_sphinx_theme'# Register the theme as an extension to generate a sitemap.xmlextensions.append("maisie_sphinx_theme")# Maisie theme options (see theme.conf for more information)html_theme_options={# Set the path to a special layout to include for the homepage"index_template":"special_index.html",# Set the name of the project to appear in the left sidebar."project_nav_name":"Project Name",# Set your Disqus short name to enable comments"disqus_comments_shortname":"my_disqus_comments_short_name",# Set you GA account ID to enable tracking"google_analytics_account":"my_ga_account",# Path to a touch icon"touch_icon":"",# Specify a base_url used to generate sitemap.xml links. If not# specified, then no sitemap will be built."base_url":"",# Allow a separate homepage from the master_doc"homepage":"index",# Allow the project link to be overriden to a custom URL."projectlink":"http://myproject.url",# 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 %}

注意

如果您使用的是readthedocs,那么您可能会遇到一个问题,即 当前不允许扩展layout.html。

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

推荐PyPI第三方库


热门话题
JAVAutil。整数java的扫描器键盘输入   java通知运行后立即崩溃   java如何在一个只能由类修改而不能由其实例修改的类中生成静态变量?   数据库Java字段猜测   返回值周围的java括号为什么?   java Android更新通讯录中的联系人   一个消费者正在读取数据   java是否可以通过编程方式为蓝牙配对设置pin?   java Spring引导和buildResponseEntity()   java为什么序列化可以在没有实现可序列化的情况下工作   Java同步无助于相互排斥   twitter Java Twitter4J未在推文下显示源标签   为什么Javasocket不支持中断处理?