Skip to content

Commit e21c620

Browse files
committed
sphinx-doc#4246: Limit width of text body for all themes
1 parent c892fe9 commit e21c620

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Incompatible changes
1313
* #3929: apidoc: Move sphinx.apidoc to sphinx.ext.apidoc
1414
* #4226: apidoc: Generate new style makefile (make-mode)
1515
* #4274: sphinx-build returns 2 as an exit code on argument error
16+
* #4246: Limit width of text body for all themes. Conifigurable via theme
17+
options ``minbodywidth`` and ``maxbodywidth``.
1618

1719
Deprecated
1820
----------

doc/theming.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ These themes are:
117117
- **sidebarwidth** (an integer): Width of the sidebar in pixels. (Do not
118118
include ``px`` in the value.) Defaults to 230 pixels.
119119

120+
- **minbodywidth** (an integer): Minimal width of the document body in
121+
pixels. Defaults to 450 pixels.
122+
123+
- **minbodywidth** (an integer): Maximal width of the document body in
124+
pixels. Defaults to 800 pixels.
125+
120126
* **alabaster** -- `Alabaster theme`_ is a modified "Kr" Sphinx theme from @kennethreitz
121127
(especially as used in his Requests project), which was itself originally based on
122128
@mitsuhiko's theme used for Flask & related projects.

sphinx/themes/basic/static/basic.css_t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ table.modindextable td {
199199

200200
/* -- general body styles --------------------------------------------------- */
201201

202+
div.body {
203+
min-width: {{ theme_minbodywidth|toint }}px;
204+
max-width: {{ theme_maxbodywidth|toint }}px;
205+
}
206+
202207
div.body p, div.body dd, div.body li, div.body blockquote {
203208
-moz-hyphens: auto;
204209
-ms-hyphens: auto;

sphinx/themes/basic/theme.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ sidebars = localtoc.html, relations.html, sourcelink.html, searchbox.html
77
[options]
88
nosidebar = false
99
sidebarwidth = 230
10+
minbodywidth = 450
11+
maxbodywidth = 800
1012
navigation_with_keys = False

0 commit comments

Comments
 (0)