简体   繁体   English

sphinx - 如何更改文档样式表

[英]sphinx - how to change documentation style sheet

I generated the Python documentation with sphinx to view it on Qt Assistant, but the theme used by the Python developers for their documentation seems to have some problems on Qt Assistant, Is there a way to override/change the theme before generating the documentation?我用sphinx生成了Python文档,可以在Qt助手上查看,但是Python开发者的文档使用的主题在Qt助手上好像有些问题,有没有办法在生成文档之前覆盖/更改主题?

在此处输入图像描述

Thanks!谢谢!

PS: I followed some indications from here http://docs.python.org/devguide/documenting.html#using-make-make-bat but instead of doing make html I did sphinx-build -b qthelp. build/qthelp PS:我遵循了这里的一些指示http://docs.python.org/devguide/documenting.html#using-make-make-bat但我没有做make html我做了sphinx-build -b qthelp. build/qthelp sphinx-build -b qthelp. build/qthelp and later qcollectiongenerator-qt4 build/qthelp/Python.qhcp . sphinx-build -b qthelp. build/qthelp和后来qcollectiongenerator-qt4 build/qthelp/Python.qhcp I used sphinx 1.1.3.我用的是狮身人面像 1.1.3。

Theming in Sphinx is easily done. Sphinx 中的主题很容易完成。 Just find the theme you want to modify in your Sphinx package directory or chose something in the variety of themes on Inte.net.只需在您的 Sphinx package 目录中找到您想要修改的主题,或者在 Inte.net 上的各种主题中选择一些主题。 What you need to do is to put the theme to some folder (for example _themes ) and add this folder to your conf.py .您需要做的是将主题放入某个文件夹(例如_themes )并将此文件夹添加到您的conf.py There should be a line for theme path in your conf.py by default.默认情况下,您的conf.py中应该有一行主题路径。 Now use the name of your theme in the conf.py under html_theme .现在在conf.py下的html_theme中使用您的主题名称。

It should do the trick.它应该可以解决问题。

Most standard themes are based on basic theme and inherit most of its classes.大多数标准主题都基于basic主题并继承了它的大部分类。 You may consider using this theme as a sandbox as it contains most stuff explicitly, without inheritance mess.您可以考虑将此主题用作沙箱,因为它明确包含大部分内容,没有 inheritance 混乱。

Also I couldn't help noticing your custom builder.我也忍不住注意到您的自定义生成器。 Custom builder may be the problem here too.自定义生成器也可能是这里的问题。 HTML theming in Sphinx would work best with the stock HTML builder. Sphinx 中的 HTML 主题与库存 HTML 构建器配合使用效果最佳。 However the basic theme could probably work better with your workflow, as it is stripped off the eye candy.然而,基本主题可能更适合您的工作流程,因为它已经去掉了视觉效果。

This was a bug on Python documentation that is now fixed:) see http://hg.python.org/cpython/rev/2a6c33592e40 and http://hg.python.org/cpython/rev/d6831d94dd1e这是 Python 文档上的一个错误,现在已修复:) 请参阅http://hg.python.org/cpython/rev/2a6c33592e40http://hg.python.org/cpythond4d1e/d468/31e

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM