Debian Codegraph @

docs/cloud_theme.rst

raw
1 .. index:: cloud; sphinx theme, sphinx theme; cloud
2
3 ====================
4 "Cloud" sphinx theme
5 ====================
6
7 Features
8 ========
9 This package provides a theme called "Cloud", used to generate this documentation.
10 Aside from being just another Sphinx theme, it has a few special features:
11
12 *Toggleable sections*
13 You can mark sections with ``.. rst-class:: html-toggle``,
14 which will make the section default to being collapsed under html,
15 with a "show section" toggle link to the right of the title.
16
17 *Additional CSS classes*
18 It provides a couple of simple styling directives for adding
19 variety to long Python library documentation:
20
21 * You can mark tables with ``.. rst-class:: html-plain-table``
22 to remove separating lines between rows.
23
24 * You can mark ``<h2>`` sections with ``.. rst-class:: emphasize-children``
25 to provide addition visual dividers between large numbers of sub-sub-sections.
26
27 *Navigation enhancements*
28 It provides options (``roottarget``, ``logotarget``) which
29 allow the table of contents to be a distinct
30 from the front page (``index.html``) of the document. This allows
31 a master table of contents to be maintained, while still allowing
32 the front page to be fully customized to welcome readers.
33
34 *Additional styling options*
35 It also provides a number of styling options controlling
36 small details such as external links, document sizing, etc.
37 See below.
38
39 It also uses an adaptive layout to work well on all screen sizes
40 from mobile phones to widescreen desktops.
41
42 *Google Analytics Integration*
43 By enabling two theme options with ``conf.py``, Cloud will
44 automatically insert a Google Analytics tracker to the bottom of each
45 page, along with a polite link allowing users to set a cookie
46 which opts them out.
47
48 List of Options
49 ===============
50
51 Structure
52 ---------
53 ``roottarget``
54 Sets the page which the title link in the navigation bar should point to
55 (defaults to the special value ``"<toc>"``, which uses the table of contents).
56
57 ``logotarget``
58 Sets the page which the sidebar logo (if any) should point to
59 (defaults to the special value ``<root>``, which just mirrors ``roottarget``).
60
61 Document Layout
62 ---------------
63 ``max_width``
64 Sets the maximum document width, so the documentation does not stretch
65 too far on wide monitors (defaults to ``11in``).
66
67 ``minimal_width``
68 Sets the maximum width where the "mobile" layout will be used.
69 This layout omits the sidebar and everything else that can be trimmed,
70 and is designed to (hopefully) be more usuable on mobile devices.
71 (defaults to ``700px``).
72
73 ``min_height``
74 sets the minimum height of the page body (defaults to ``6in``).
75
76 .. versionchanged:: 1.7
77
78 ``compact_width`` option has been removed, and will be ignored.
79 (it previously provided an intermediate level of padding between ``minimal_width`` and ``max_width``).
80
81 .. _font-options:
82
83 Font Sizing
84 -----------
85 ``default_layout_text_size``
86
87 Sets the default font size for the whole document (defaults to ``87.5%``
88 of browser default).
89
90 ``minimal_layout_text_size``
91
92 Sets the default font size for the whole document when the "mobile"
93 layout is being used (defaults to ``75%`` of browser default).
94
95 Sidebar Layout & Styling
96 ------------------------
97 ``rightsidebar``
98 whether the sidebar is on the right side instead of the left
99 (defaults to ``false``).
100
101 ``defaultcollapsed``
102 whether the sidebar should start collapsed (defaults to ``false``).
103
104 ``stickysidebar``
105 whether the sidebar should "stick" in the current window
106 (defaults to ``true``), otherwise it will scroll along with the page.
107
108 ``highlighttoc``
109 whether sidebar should highlight the sections which are currently
110 being viewed (defaults to ``true``).
111
112 Sidebar Labels
113 --------------
114 ``sidebar_localtoc_title``
115 Override title of per-page table of contents (in ``localtoc.html`` sidebar).
116 defaults to ``Page contents``.
117
118 ``sidebar_prev_title``
119 Override title of link to previous page (in ``relations.html`` sidebar).
120 defaults to ``Previous page``.
121
122 ``sidebar_next_title``
123 Override title of link to next page (in ``relations.html`` sidebar).
124 defaults to ``Next page``.
125
126 ``sidebar_master_title``
127 Override title of the front-page document link (in ``quicklinks.html`` sidebar).
128
129 ``sidebar_root_title``
130 Override title of the root document link (in ``quicklinks.html`` sidebar).
131
132 .. _decor-options:
133
134 Document Styling
135 ----------------
136 ``lighter_header_decor``
137 Optional boolean flag which render headers in a lighter underlined
138 style, rather than with a solid background. Also enables other related
139 stylistic changes.
140
141 ``shaded_decor``
142 Optional boolean flag which adds a slight amount of shading
143 to sidebar, navbars, and section headers.
144
145 ``borderless_decor``
146 Optional boolean flag which makes page background match document background.
147 Also enables other related stylistic changes.
148
149 Styling
150 -------
151 ``externalrefs``
152 Boolean flag that controls whether references should be displayed with an icon.
153 (defaults to ``True``).
154
155 ``externalicon``
156 Optional image or string to prefix before any external links
157 (defaults to ``⇗``, ignored if ``externalrefs=False``).
158
159 ``issueicon``
160 Optional image or string to prefix before any issue tracker links
161 generated by :mod:`cloud_sptheme.ext.issue_tracker`
162 (defaults to ``✧``, ignored if ``externalrefs=False``).
163
164 .. note::
165
166 There are a number of options for changing the various colors
167 and fonts used by this theme, which are still undocumented.
168 A complete list can be found in the theme's configuration file
169 (``/cloud_sptheme/themes/cloud/theme.conf``).
170
171 Other
172 -----
173 ``googleanalytics_id``
174 Setting this via ``html_theme_options`` to your GA id (e.g. ``UA-XXXXXXXX-X``)
175 will enable a `Google Analytics <http://www.google.com/analytics>`_
176 tracker for all pages in the document, as well insert a link in
177 the footer allowing users to opt out of tracking.
178
179 ``googleanalytics_path``
180 Setting this allows limiting the tracker to a subpath,
181 useful for shared documentation hosting (e.g. PyPI or ReadTheDocs).
182
183 .. _cloud-theme-usage:
184
185 Usage
186 =====
187 Using the theme
188 ---------------
189 To use the cloud theme, make sure this package is installed properly,
190 then open your documentation's Sphinx ``conf.py`` file,
191 and make the following changes::
192
193 # set the html theme
194 html_theme = "cloud"
195 # NOTE: there are also alternate versions named "redcloud" and "greencloud"
196
197 # ... some contents omitted ...
198
199 # [optional] set some of the options listed above...
200 html_theme_options = { "roottarget": "index" }
201
202 .. rst-class:: floater
203
204 .. seealso::
205
206 See the next page (:doc:`cloud_theme_test`) for examples of
207 these options in action.
208
209 Section Styles
210 --------------
211
212 Emphasized Children
213 ...................
214 Adding ``.. rst-class:: emphasize-children`` to a 2nd-level section header
215 will cause the headers of all of it's child sections to be emphasized with a solid background.
216 This is mainly useful for very long sections, where there needs to be
217 a visual divide between 3rd-level sections.
218
219 Toggleable Sections
220 ...................
221 By adding ``.. rst-class:: html-toggle`` before any section header,
222 it can be made toggleable::
223
224 .. rst-class:: html-toggle
225
226 Toggleable Section
227 ------------------
228
229 This section is collapsed by default.
230
231 While toggleable sections start out collapsed by default,
232 you can use ``.. rst-class:: html-toggle expanded`` to override this.
233
234 Table Styles
235 ------------
236 * Adding ``.. rst-class:: plain`` can be used to remove
237 the row shading and other styling from a table.
238
239 * Adding ``.. rst-class:: centered`` can be used to center a table.
240
241 .. deprecated:: 1.10.0, use docutils' ``:align: center`` directive instead.
242
243 * Adding ``.. rst-class:: fullwidth`` can be used to expand a table
244 to the full width of the page.
245
246 .. seealso::
247 The :mod:`~cloud_sptheme.ext.table_styling` extension
248 for additional table styling abilities, e.g. per-column text alignment.