斯芬克斯文档项目的Documatt主题

sphinx-documatt-theme的Python项目详细描述


移动友好的斯芬克斯主题,旨在提供伟大的文件阅读体验与美丽的排版。在

这个主题是Documatt的Techwriter at work blog的默认主题,但是欢迎您将其用于任何Sphinx项目。在

https://gitlab.com/documatt/sphinx-themes/-/raw/master/sphinx_documatt_theme/screenshot.png?inline=false

安装

安装(在命令行上):

$ pip install sphinx-documatt-theme

使用它(在您的conf.py)中:

^{pr2}$

配置

主题为唯一选项-设置“座右铭”默认显示在封面(靠近页眉的面包屑块下方)和页脚中。树立自己的座右铭:

html_theme_options = {
    "motto": "Write and read beautiful books and documentation in easy way with our powerful writing platform."
}

定制

要自定义主题,请在Sphinx项目根目录中创建_templates/layout.htmllayout.html是要重写的最重要的模板。以扩展名启动文件:

{% extends "!layout.html" %}

现在您可以覆盖(自定义)所谓的块,即页面的一部分。最重要的模块是:

  • mastercover用于母版页的封面(有时称为英雄)(通常index.rst)。封面显示在面包屑导航下面。在
  • nonmastercover用于非母版页的封面(通常是index.rst除外)的封面。默认情况下,两个封面块都显示座右铭。在
  • coverrightcolumnright列位于封面旁边,例如对于社交按钮很有用。在
  • rightsidebarright列,位于主文档正文旁边。同样,通常用于放置共享按钮。在
  • extrafooter块在尾随</body>之前。默认情况下为空,但它是放置网站分析HTML代码或cookie bar的理想位置。在

完整的例子可能是:

{% extends "!layout.html" %}

{% block mastercover %}
    <h1 class="title is-2 has-text-primary">
        Techwriter at work <span class="has-text-weight-light">blog</span>.
    </h1>
    <h2 class="subtitle is-4">
        Living and writing documentation at Documatt, small team of programmers
        that <span class="has-text-primary">do write</span> documentation too.
    </h2>
{% endblock %}

{% block coverrightcolumn %}
    <a href="https://twitter.com/documattcom?ref_src=twsrc%5Etfw"
       class="twitter-follow-button" data-show-count="false">Follow us</a>
    <script async src="https://platform.twitter.com/widgets.js"
            charset="utf-8"></script>
{% endblock %}

{% block extrafooter %}
    <script type="text/javascript"
    src="https://cdn.jsdelivr.net/npm/cookie-bar/cookiebar-latest.min.js?theme=grey&tracking=1&thirdparty=1&always=1&hideDetailsBtn=1&showPolicyLink=1&privacyPage=https%3A%2F%2Fdocumatt.com%2Fabout%2Flegal%2Fprivacy%2F"></script>
{% endblock %}

打开theme’s layout.html以查看可以重写的所有块。在

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

推荐PyPI第三方库


热门话题
ws-consumer服务地址中的java动态属性   java如何比较整数列表,然后按升序排序?   javascript我正在使用java脚本调用一个函数,但它没有调用代码下面的方法,也没有调用secretitnames()函数   在文本窗格中多次使用Java insertIcon图标   JavaMSAL安卓。AuthenticationActivity完成,但用于身份验证请求的线程池线程仍处于等待状态   if语句中的java多范围比较   java toString()表示输出   java如何在jcstrest测试中生成指令重新排序   java我怎样才能运行它?   web应用程序中使用Hibernate和Spring的java问题   如何将字符串数据写入Java文本文件   如何在java命令提示符下运行已签名的jar文件?   java从我的菜单调用RCP应用程序   java如何等待Canvas/GraphicsContext完成任务,然后再继续执行代码块?