Skip to content

Commit eb0a6c5

Browse files
choldgrafAA-Turner
andauthored
Update documentation structure and theming (#10677)
Co-authored-by: Adam Turner <[email protected]>
1 parent a504ac6 commit eb0a6c5

File tree

11 files changed

+186
-89
lines changed

11 files changed

+186
-89
lines changed

doc/_themes/sphinx13/layout.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ <h3>{{ _('Navigation') }}</h3>
3232
{%- block content %}
3333
<div class="document">
3434
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
35-
{%- include "searchbox.html" %}
36-
<div>
37-
<h3>{{ _('Contents') }}</h3>
38-
{%- if pagename != "index" %}
35+
{%- include "searchbox.html" %}
36+
<div class="sphinxsidebar-navigation__contents">
37+
<h3>{{ _('On this page') }}</h3>
3938
{{ toc }}
40-
{%- else %}
41-
{{ toctree(includehidden=True, maxdepth=3) }}
42-
{%- endif %}
43-
</div>
39+
</div>
40+
<div class="sphinxsidebar-navigation__pages">
41+
<h3>{{ _('Site navigation') }}</h3>
42+
{{ toctree(includehidden=True, maxdepth=3, titles_only=True) }}
43+
</div>
4444
</div>
4545
{%- block document %}
4646
<div class="body" role="main">

doc/_themes/sphinx13/static/sphinx13.css

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ div.document {
2727
div.body {
2828
border-left: 1px solid var(--colour-sphinx-blue);
2929
margin: 0;
30-
padding: 0.5em 1.25em;
30+
padding: 0.5em 1.75em;
3131
min-width: 0;
3232
max-width: 800px;
3333
}
@@ -59,10 +59,15 @@ div.sphinxsidebarwrapper {
5959
}
6060

6161
div.sphinxsidebar {
62+
position: sticky;
63+
top: 0;
64+
align-self: flex-start;
65+
height: 100vh;
66+
width: 250px;
67+
overflow-y: auto;
6268
overflow-wrap: break-word;
6369
margin: 0;
6470
padding-right: 15px;
65-
width: 210px;
6671
font-size: 1em;
6772
}
6873

@@ -99,8 +104,27 @@ div.sphinxsidebar ul {
99104
}
100105

101106
div.sphinxsidebar ul ul {
102-
margin-left: 20px;
107+
margin-left: 1rem;
103108
list-style-type: none;
109+
font-size: .9em;
110+
}
111+
112+
/* De-dent the first list because we hide the top-level item */
113+
.sphinxsidebar .sphinxsidebar-navigation__contents > ul > li > ul {
114+
margin-left: 0;
115+
}
116+
117+
div.sphinxsidebar p.caption {
118+
font-weight: 300;
119+
font-size: 1.2rem;
120+
}
121+
122+
div.sphinxsidebar li.current > a {
123+
font-weight: 600;
124+
}
125+
126+
.sphinxsidebar-navigation__contents > ul > li > a {
127+
display: none;
104128
}
105129

106130
div.footer {
@@ -170,11 +194,10 @@ div.body h1 a tt, div.body h2 a tt, div.body h3 a tt, div.body h4 a tt, div.body
170194

171195
a.headerlink {
172196
color: var(--colour-sphinx-blue) !important;
173-
font-size: 12px;
197+
font-size: .8em;
174198
margin-left: 6px;
175199
padding: 0 4px 0 4px;
176200
text-decoration: none !important;
177-
float: right;
178201
}
179202

180203
a.headerlink:hover {
@@ -250,6 +273,12 @@ div.quotebar {
250273
margin-left: 1em;
251274
}
252275

276+
blockquote {
277+
font-size: 1.5em;
278+
padding-left: 1rem;
279+
margin-left: 0;
280+
}
281+
253282
nav.contents,
254283
div.topic,
255284
aside.topic {
@@ -271,11 +300,11 @@ div.admonition, div.warning {
271300
border: 1px solid #86989B;
272301
border-radius: 2px;
273302
background-color: #f7f7f7;
274-
padding: 0;
303+
padding: 1rem;
275304
}
276305

277306
div.admonition > p, div.warning > p {
278-
margin: 0.5em 1em 0.5em 1em;
307+
margin: 0;
279308
padding: 0;
280309
}
281310

@@ -285,7 +314,6 @@ div.admonition > pre, div.warning > pre {
285314

286315
div.admonition > p.admonition-title,
287316
div.warning > p.admonition-title {
288-
margin-top: 0.5em;
289317
font-weight: bold;
290318
}
291319

doc/index.rst

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,9 @@
22
Welcome
33
=======
44

5-
**Sphinx makes it easy to create intelligent and beautiful documentation.**
5+
.. epigraph:: Sphinx makes it easy to create intelligent and beautiful documentation.
66

7-
Install
8-
=======
9-
10-
Install Sphinx with ``pip install -U Sphinx``. See :doc:`usage/installation` for
11-
further details.
12-
13-
Features
14-
========
7+
Here are some of Sphinx's major features:
158

169
* **Output formats:** HTML (including Windows HTML Help), LaTeX (for printable
1710
PDF versions), ePub, Texinfo, manual pages, plain text
@@ -24,78 +17,98 @@ Features
2417
indices
2518
* **Code handling:** automatic highlighting using the Pygments_ highlighter
2619
* **Extensions:** automatic testing of code snippets, inclusion of docstrings
27-
from Python modules (API docs), and :ref:`more <builtin-extensions>`
28-
* **Contributed extensions:** dozens of extensions
29-
:ref:`contributed by users <third-party-extensions>`; most of them installable
30-
from PyPI
31-
32-
.. _Pygments: https://pygments.org/
33-
34-
Sphinx uses reStructuredText_ as its markup language, and many of its strengths
35-
come from the power and straightforwardness of reStructuredText and its parsing
36-
and translating suite, the Docutils_.
20+
from Python modules (API docs) via :ref:`built-in extensions
21+
<builtin-extensions>`, and much more functionality via :ref:`third-party
22+
extensions <third-party-extensions>`.
23+
* **Themes:** modify the look and feel of outputs via :doc:`creating themes
24+
<development/theming>`, and re-use many :ref:`third-party themes
25+
<third-party-themes>`.
26+
* **Contributed extensions:** dozens of extensions :ref:`contributed by users
27+
<third-party-extensions>`; most of them installable from PyPI.
3728

3829
.. _reStructuredText: https://docutils.sourceforge.io/rst.html
3930
.. _Docutils: https://docutils.sourceforge.io/
31+
.. _Pygments: https://pygments.org/
4032

41-
Documentation
42-
=============
33+
Sphinx uses the reStructuredText_ markup language by default, and can read
34+
:ref:`MyST markdown <markdown>` via third-party extensions. Both of these
35+
are powerful and straightforward to use, and have functionality
36+
for complex documentation and publishing workflows. They both build upon
37+
Docutils_ to parse and write documents.
4338

44-
* :doc:`First steps with Sphinx <usage/quickstart>`: overview of basic tasks
45-
* :doc:`Tutorial <tutorial/index>`: beginners tutorial
46-
* :ref:`Search page <search>`: search the documentation
47-
* :doc:`Changes <changes>`: release history
48-
* :ref:`General Index <genindex>`: all functions, classes, terms
49-
* :ref:`Python Module Index <modindex>`: the index of Python modules
50-
* :doc:`Glossary <glossary>`: definitions of various terms
51-
* :doc:`Sphinx's Authors <internals/authors>`: the Sphinx developers
52-
* `Contents <contents.html>`__: full table of contents
39+
See below for how to navigate Sphinx's documentation.
5340

54-
Support
55-
=======
41+
.. seealso::
5642

57-
For questions or to report problems with Sphinx, join the `sphinx-users`_
58-
mailing list on Google Groups, come to the ``#sphinx-doc`` channel on
59-
`libera.chat`_, or open an issue at the tracker_.
43+
The `Sphinx documentation Table of Contents <contents.html>`_ has
44+
a full list of this site's pages.
6045

61-
.. _sphinx-users: https://groups.google.com/group/sphinx-users
62-
.. _libera.chat: https://web.libera.chat/?channel=#sphinx-doc
63-
.. _tracker: https://github.com/sphinx-doc/sphinx/issues
46+
.. _get-started:
6447

65-
Examples of other projects using Sphinx can be found in the :doc:`examples page
66-
<examples>`. A useful tutorial_ has been written by the matplotlib developers.
48+
Get started
49+
===========
6750

68-
.. _tutorial: http://matplotlib.sourceforge.net/sampledoc/
51+
These sections cover the basics of getting started with Sphinx, including
52+
creating and building your own documentation from scratch.
6953

70-
There is a translation team in Transifex_ of this documentation, thanks to the
71-
Sphinx document translators.
54+
.. toctree::
55+
:maxdepth: 2
56+
:caption: Get started
7257

73-
.. _Transifex: https://www.transifex.com/sphinx-doc/sphinx-doc/dashboard/
58+
usage/quickstart
59+
usage/installation
60+
tutorial/index
7461

75-
Contributor guide
76-
=================
62+
.. _user-guides:
7763

78-
See the :doc:`Sphinx contributors' guide <internals/contributing>` if you would
79-
like to contribute to the project.
64+
User Guides
65+
===========
8066

81-
.. master toctree:
67+
These sections cover various topics in using and extending Sphinx for various
68+
use-cases. They are a comprehensive guide to using Sphinx in many contexts and
69+
assume more knowledge of Sphinx. If you are new to Sphinx, we recommend
70+
starting with :ref:`get-started`.
8271

8372
.. toctree::
84-
:maxdepth: 5
85-
:hidden:
73+
:maxdepth: 2
74+
:caption: User Guides
8675

8776
usage/index
88-
tutorial/index
8977
development/index
90-
man/index
91-
9278
templating
9379
latex
9480
extdev/index
9581

96-
internals/index
82+
Community guide
83+
===============
84+
85+
Sphinx is community supported and welcomes contributions from anybody.
86+
The sections below should help you get started joining the Sphinx community
87+
as well as contributing.
88+
89+
See the :doc:`Sphinx contributors' guide <internals/contributing>` if you would
90+
like to contribute to the project.
91+
92+
.. toctree::
93+
:maxdepth: 2
94+
:caption: Community
9795

96+
support
97+
internals/index
9898
faq
99+
100+
Reference guide
101+
===============
102+
103+
Reference documentation is more complete and programmatic in nature, it is a
104+
collection of information that can be quickly referenced. If you would like
105+
usecase-driven documentation, see :ref:`get-started` or :ref:`user-guides`.
106+
107+
.. toctree::
108+
:maxdepth: 2
109+
:caption: Reference
110+
111+
man/index
99112
glossary
100113
changes
101114
examples

doc/internals/contributing.rst

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ feature requests, writing new documentation or submitting patches for new or
77
fixed behavior. This guide serves to illustrate how you can get started with
88
this.
99

10-
Getting help
11-
------------
10+
Get help
11+
--------
1212

1313
The Sphinx community maintains a number of mailing lists and IRC channels.
1414

@@ -46,8 +46,8 @@ and post that instead.
4646
.. _`sphinx-dev`: mailto:[email protected]
4747

4848

49-
Writing code
50-
------------
49+
Contribute code
50+
---------------
5151

5252
The Sphinx source code is managed using Git and is hosted on `GitHub`__. The
5353
recommended way for new contributors to submit code to Sphinx is to fork this
@@ -57,6 +57,8 @@ before it is merged into the main repository.
5757

5858
.. __: https://github.com/sphinx-doc/sphinx
5959

60+
.. _contribute-get-started:
61+
6062
Getting started
6163
~~~~~~~~~~~~~~~
6264

@@ -235,15 +237,38 @@ If you want to know more detailed usage, please refer to ``tests/conftest.py``
235237
and other ``test_*.py`` files under ``tests`` directory.
236238

237239

238-
Writing documentation
239-
---------------------
240+
Contribute documentation
241+
------------------------
242+
243+
Contributing to documentation involves modifying the source files found in the
244+
``doc/`` folder. To get started, you should first follow :ref:`contribute-get-started`,
245+
and then take the steps below to work with the documentation.
246+
247+
The following sections describe how to get started with contributing
248+
documentation, as well as key aspects of a few different tools that we use.
240249

241250
.. todo:: Add a more extensive documentation contribution guide.
242251

243-
You can build documentation using ``tox``::
252+
Build the documentation
253+
~~~~~~~~~~~~~~~~~~~~~~~
254+
255+
We use `the tox tool <https://tox.wiki/en/latest/>`__ to quickly build the
256+
documentation. Tox is kind-of like a Makefile, but includes the ability to
257+
intsall an isolated environment used to run each task.
258+
259+
To build the documentation with ``tox``, run the following command::
244260

245261
tox -e docs
246262

263+
This will parse the Sphinx documentation's source files and generate HTML for
264+
you to preview in ``build/sphinx/html``.
265+
266+
You can also build a **live version of the documentation** that you can preview
267+
in the browser. It will detect changes and reload the page any time you make
268+
edits. To do so, run the following command::
269+
270+
tox -e docs-live
271+
247272
Translations
248273
~~~~~~~~~~~~
249274

doc/internals/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
================
2-
Sphinx internals
3-
================
1+
====================
2+
Contribute to Sphinx
3+
====================
44

55
This guide contains information about the Sphinx open source project itself.
66
This is where you can find information about how Sphinx is managed and learn

doc/man/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Man Pages
2-
=========
1+
Command-Line Tools
2+
==================
33

44
These are the applications provided as part of Sphinx.
55

0 commit comments

Comments
 (0)