修改Sphinx主题“阅读文档"的内容宽度 [英] Modifying content width of the Sphinx theme 'Read the Docs'

查看:339
本文介绍了修改Sphinx主题“阅读文档"的内容宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文档中使用阅读文档" Sphinx主题.在原始主题中,如下所示

I am using 'Read the Docs' Sphinx theme for my documentation. In the original theme, given below

http://read-the-docs.readthedocs.org/zh/latest/theme.html

内容或主布局的宽度被设计为适合移动设备使用.但是,对于我的项目,我希望范围更广一些.我不懂HTML,因此不胜感激是否有人可以给我一些线索来增加内容(布局)的宽度.

the content or main layout width is designed to be mobile friendly. However, for my project I would like this to be a bit more wide. I do not know HTML and hence would appreciate if any one could give me some clues to increase the content (layout) width.

推荐答案

另一种选择是在source/_static中仅使用所需的CSS创建样式表,例如

Another option is to create a stylesheet in source/_static with just the css you want, e.g.

.wy-nav-content {
    max-width: none;
}

.wy-nav-content {
    max-width: 1200px !important;
}

请确保在source/conf.py中引用了该目录-我相信默认情况下,有一行可以执行此操作,即

Make sure the directory is referenced in source/conf.py - I believe by default there's a line to do this, i.e.

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

然后在source/_templates/layout.html中创建自定义布局,并执行类似的操作以包含样式表

Then create a custom layout in source/_templates/layout.html and do something like this to include your stylesheet

{% extends "!layout.html" %}
{% block extrahead %}
    <link href="{{ pathto("_static/style.css", True) }}" rel="stylesheet" type="text/css">
{% endblock %}

假设您调用了样式表style.css

这篇关于修改Sphinx主题“阅读文档"的内容宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆