Skip to content

Commit 1909f67

Browse files
authored
Add inline tabs on Documentation Getting Started page for commands on different systems (#1224)
1 parent a1e39bf commit 1909f67

File tree

1 file changed

+71
-26
lines changed

1 file changed

+71
-26
lines changed

documentation/start-documenting.rst

Lines changed: 71 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
Getting started
66
===============
77

8+
.. raw:: html
9+
10+
<script>
11+
document.addEventListener('DOMContentLoaded', function() {
12+
activateTab(getOS());
13+
});
14+
</script>
15+
816
.. highlight:: rest
917

1018
The Python language has a substantial body of documentation, much of it
@@ -81,22 +89,24 @@ Create a virtual environment
8189
----------------------------
8290

8391
.. _doc-create-venv-unix:
92+
.. _doc-create-venv-windows:
8493

85-
**On Unix platforms** that support :program:`make`
86-
(including Linux, macOS and BSD),
87-
you can create a new :mod:`venv` with the required dependencies using::
94+
You can create a new :mod:`venv` with the required dependencies using:
8895

89-
make venv
96+
.. tab:: Unix/macOS
9097

91-
Building the docs with :program:`make` will automatically use this environment
92-
without you having to activate it.
98+
.. code-block:: shell
9399
94-
.. _doc-create-venv-windows:
100+
make venv
101+
102+
Building the docs with :program:`make` will automatically use this environment
103+
without you having to activate it.
104+
105+
.. tab:: Windows
95106

96-
**On Windows**, or if not using :program:`make`,
97-
`create a new virtual environment <venv-create_>`__ manually.
98-
Always be sure to `activate this environment <venv-activate_>`__
99-
before building the documentation.
107+
`Create a new virtual environment <venv-create_>`__ manually.
108+
Always be sure to `activate this environment <venv-activate_>`__
109+
before building the documentation.
100110

101111

102112
.. _building-using-make:
@@ -106,21 +116,36 @@ before building the documentation.
106116
Build using make / make.bat
107117
---------------------------
108118

109-
A Unix ``Makefile`` is provided, :cpy-file:`Doc/Makefile`,
110-
along with a :cpy-file:`Doc/make.bat` batch file for Windows
111-
that attempts to emulate it as closely as practical.
119+
.. tab:: Unix/macOS
120+
121+
A Unix ``Makefile`` is provided, :cpy-file:`Doc/Makefile`.
122+
123+
.. tab:: Windows
124+
125+
A Windows ``make.bat`` is provided, :cpy-file:`Doc/make.bat`, which
126+
attempts to emulate the Unix ``Makefile`` as closely as practical.
127+
128+
.. important::
129+
130+
The Windows ``make.bat`` batch file lacks a ``make venv`` target.
131+
Instead, it automatically installs any missing dependencies
132+
into the currently activated environment (or the base Python, if none).
133+
Make sure the environment you :ref:`created above <doc-create-venv-windows>`
134+
is `activated <venv-activate_>`__ before running ``make.bat``.
135+
136+
To build the docs as HTML, run:
112137

113-
.. important::
138+
.. tab:: Unix/macOS
114139

115-
The Windows ``make.bat`` batch file lacks a ``make venv`` target.
116-
Instead, it automatically installs any missing dependencies
117-
into the currently activated environment (or the base Python, if none).
118-
Make sure the environment you :ref:`created above <doc-create-venv-windows>`
119-
is `activated <venv-activate_>`__ before running ``make.bat``.
140+
.. code-block:: shell
120141
121-
To build the docs as HTML, run::
142+
make html
122143
123-
make html
144+
.. tab:: Windows
145+
146+
.. code-block:: dosbatch
147+
148+
.\make html
124149
125150
.. tip:: * Replace ``html`` with ``htmlview`` to open the docs in a web browser
126151
once the build completes.
@@ -129,13 +154,33 @@ To build the docs as HTML, run::
129154
browser when you make changes to reST files (Unix only).
130155

131156
To check the docs for common errors with `Sphinx Lint`_
132-
(which is run on all :ref:`pull requests <pullrequest>`), use::
157+
(which is run on all :ref:`pull requests <pullrequest>`), use:
158+
159+
.. tab:: Unix/macOS
160+
161+
.. code-block:: shell
162+
163+
make check
164+
165+
.. tab:: Windows
166+
167+
.. code-block:: dosbatch
168+
169+
.\make check
170+
171+
To list other supported :program:`make` targets, run:
172+
173+
.. tab:: Unix/macOS
174+
175+
.. code-block:: shell
176+
177+
make help
133178
134-
make check
179+
.. tab:: Windows
135180

136-
To list other supported :program:`make` targets, run::
181+
.. code-block:: dosbatch
137182
138-
make help
183+
.\make help
139184
140185
See :cpy-file:`Doc/README.rst` for more information.
141186

0 commit comments

Comments
 (0)