You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: developer/general/how-to-edit-the-rst-documentation.rst
+54-46Lines changed: 54 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,11 @@ How to edit the documentation
4
4
5
5
The Qubes OS documentation is stored as `reStructuredText (rST) <https://docutils.sourceforge.io/rst.html>`__ files in
6
6
the `qubes-doc <https://github.com/QubesOS/qubes-doc>`__ repository.
7
+
7
8
We use `Sphinx <https://www.sphinx-doc.org/>`__ for building and
8
9
`Read The Docs (RTD) <https://readsthedocs.com/>`__ for hosting.
9
-
RTD is a `continuous‑documentation deployment platform <https://docs.readthedocs.com/platform/stable/continuous-deployment.html>`__ that automatically detects changes in the qubes-doc GittHub repository and builds the latest version of the docs.
10
+
RTD is a `continuous‑documentation deployment platform <https://docs.readthedocs.com/platform/stable/continuous-deployment.html>`__ that can automatically
11
+
detect changes in a GitHub repository and build the latest version of a documentation.
10
12
11
13
.. figure:: /attachment/doc/rst-rtd-workflow.png
12
14
:alt:Qubes OS Documentation Workflow - once new documentation is written or changed, it is built and verified with Sphinx, pushed on GitHub/GitLab and hosted on RTD
@@ -16,7 +18,8 @@ RTD is a `continuous‑documentation deployment platform <https://docs.readthedo
16
18
17
19
By cloning and regularly pulling from `qubes-doc <https://github.com/QubesOS/qubes-doc>`__ repository, users can maintain their
18
20
own up-to-date offline copy of the Qubes documentation rather than
19
-
relying solely on the web. EPUB or PDF versions of Qubes OS documenation can also
21
+
relying solely on the web and either serve it locally or read the rST files directly.
22
+
EPUB or PDF versions of Qubes OS documenation can also
20
23
be downloaded from `doc.qubes-os.org <https://doc.qubes-os.org/en/latest/>`__:
21
24
22
25
|epub-pdf|
@@ -25,6 +28,8 @@ be downloaded from `doc.qubes-os.org <https://doc.qubes-os.org/en/latest/>`__:
25
28
TODO screenshots with main branch instead of rst when rst merged in main
26
29
TODO add draft pull request screenshot
27
30
31
+
32
+
28
33
The documentation is a volunteer community effort. People like you are
29
34
constantly working to make it better. If you notice something that can
30
35
be fixed or improved, please follow the steps below to open a pull
@@ -56,16 +61,17 @@ A few notes before we get started:
56
61
work from the command line, you can skip the rest of this section. All
57
62
you need to do to contribute is to `fork and clone <https://guides.github.com/activities/forking/>`__
58
63
the `qubes-doc <https://github.com/QubesOS/qubes-doc>`__ repo, make your changes,
59
-
then `submit a pull request <https://help.github.com/articles/using-pull-requests/>`__.)
64
+
then `submit a pull request <https://help.github.com/articles/using-pull-requests/>`__.
65
+
You can continue reading :ref:`viewing_pr`.)
60
66
61
-
Ok, let’s begin. Every documentation page has a “Edit on GitHub” link.
67
+
Ok, let’s begin. Every documentation page has a :guilabel:`Edit on GitHub` link.
62
68
63
69
|page-source-button|
64
70
65
71
When you click on it, you’ll be taken to the source file — a reStructuredText (``.rst``) file — on GitHub.
66
72
67
73
On this page, there will be a
68
-
button to edit the file (if you are already logged in in).
74
+
button to edit the file (if you are already logged in).
69
75
70
76
..
71
77
TODO screenshot when rst merged in main
@@ -79,12 +85,12 @@ You can also create a free account from here.
79
85
|github-sign-in|
80
86
81
87
If this is your first contribution to the documentation, you need to
82
-
:guilabel:`fork` the repository (make your own copy).
88
+
fork the repository (make your own copy).
83
89
84
90
|fork1|
85
91
86
92
It’s easy — just click the
87
-
green :guilabel:`Create fork` on the next page. This step is only needed the first
93
+
green :guilabel:`Create fork` button on the next page. This step is only needed the first
88
94
time you make a contribution.
89
95
90
96
@@ -94,24 +100,23 @@ Now you can make your modifications.
94
100
95
101
|fork3|
96
102
97
-
You can also preview the changes by clicking the :guilabel:`Preview changes` tab.
98
-
99
-
If you want to add images, read :ref:`how_to_add_images`.
100
-
and refer to :ref:`build_locally`
101
-
if you want to locally verify that everything looks correct before submitting any changes.
103
+
.. You can also preview the changes by clicking the :guilabel:`Preview changes` tab.
102
104
103
105
104
106
|edit|
105
107
108
+
If you want to add images, read :ref:`how_to_add_images` and refer to :ref:`build_locally`
109
+
if you want to locally verify that everything looks correct before submitting any changes.
110
+
106
111
107
112
Once you’re finished, describe your changes at the bottom and click
108
113
:guilabel:`Commit changes`.
109
114
110
115
|commit|
111
116
112
117
After that, you’ll see exactly what modifications you’ve made. At this
113
-
stage, those changes are still in your own copy of the documentation
114
-
(“fork”). If everything looks good, send those changes to us by pressing
118
+
stage, those changes are still in your own copy (fork) of the documentation.
119
+
If everything looks good, send those changes to us by pressing
115
120
the :guilabel:`Create pull request` button.
116
121
117
122
@@ -135,11 +140,14 @@ can’t accept your pull request, we’ll post a comment explaining why we
135
140
can’t.
136
141
137
142
143
+
.. _viewing_pr:
144
+
138
145
Viewing your pull request on RTD
139
146
--------------------------------
140
147
141
148
Every time you push a commit to your pull request, a build on RTD will be triggered.
142
-
To view your PR you can go to Qubes OS builds on `RTD <https://app.readthedocs.org/projects/qubes-doc/builds/>`__:
149
+
To view your PR you can go to Qubes OS builds on `RTD <https://app.readthedocs.org/projects/qubes-doc/builds/>`__,
150
+
find the last build of your PR and click on it:
143
151
144
152
|pull-request-builds|
145
153
@@ -198,14 +206,11 @@ If you want to add a newly created documentation file, do so as follows:
198
206
.. code-block:: rst
199
207
200
208
.. toctree:
201
-
old_doc_file_name
202
-
new_doc_file_name
209
+
/path/to/old_doc_file_name
210
+
/path/to/new_doc_file_name
203
211
204
212
205
213
Editing this file will change what appears on the documentation index.
206
-
If your pull request (PR) adds, removes, or edits anything that should
207
-
be reflected in the documentation index, please make sure you also
208
-
submit an associated pull request against this file.
209
214
210
215
Please always be mindful that rST syntax is sensitive to indentation (3 spaces)!
211
216
@@ -226,7 +231,7 @@ To add an image to a page, use the following syntax:
If you want to add a caption to the image, you may do so using the ``caption`` option of the `figure directive <https://docutils.sourceforge.io/docs/ref/rst/directives.html#figure>`__.
234
+
If you want to add a caption to the image, you may do so using the optional ``caption`` of the `figure directive <https://docutils.sourceforge.io/docs/ref/rst/directives.html#figure>`__.
230
235
Another way without a caption is to use the `image directive <https://docutils.sourceforge.io/docs/ref/rst/directives.html#image>`__.
231
236
232
237
Then, add your image(s) in a the :file:`attachment/doc` folder in the `qubes-doc <https://github.com/QubesOS/qubes-doc>`__
@@ -272,6 +277,27 @@ which will refer to :ref:`this section <introduction/faq:what does it mean to "d
272
277
For further options and use cases please refer to `Cross-references <https://www.sphinx-doc.org/en/master/usage/referencing.html>`__.
273
278
274
279
280
+
Qubes OS rST configuration
281
+
==========================
282
+
283
+
:file:`qubes-doc` directory contains a build configuration file named :file:`conf.py`, used by Sphinx
284
+
to define `input and output behaviour <https://www.sphinx-doc.org/en/master/usage/configuration.html>`__.
285
+
It contains settings and extensions that define how the documentation will be generated.
286
+
You can find it `here <https://github.com/QubesOS/qubes-doc/blob/rst/conf.py>`__.
287
+
288
+
You can also find a :file:`readthedocs.yml` `file <https://github.com/QubesOS/qubes-doc/blob/rst/.readthedocs.yaml>`__
289
+
which tells RTD how to build the documentation. It defines the build environment, Python version, required dependencies,
290
+
and which Sphinx configuration to run. Thus RTD automatically generates and hosts the docs.
291
+
292
+
293
+
Extensions
294
+
----------
295
+
296
+
We use several Sphinx `extensions <https://www.sphinx-doc.org/en/master/usage/extensions/index.html>`__
297
+
as defined in :file:`conf.py`, as well a simple custom one to embed YouTube videos,
298
+
which can be found `here <https://github.com/QubesOS/qubes-doc/tree/rst/_ext>`__.
299
+
300
+
275
301
.. _build_locally:
276
302
277
303
Building the rST documentation locally
@@ -282,7 +308,9 @@ In order to build the Qubes OS rST documentation locally clone the `qubes-doc <h
282
308
(or your forked one if you want to submit a pull request).
283
309
284
310
285
-
It is recommended to use a virtual environment, f.ex. venv or uv poetry.
311
+
It is recommended to use a virtual environment, f.ex.
`poetry <https://python-poetry.org/>`__ or `uv <https://docs.astral.sh/uv/>`__.
286
314
In the following section there is a sample setup to prepare local environments
287
315
for building Qubes OS rST documentation.
288
316
@@ -428,7 +456,7 @@ A :file:`pyproject.toml` file is provided.
428
456
$ poetry run sphinx-autobuild ../qubes-doc _build/html
429
457
430
458
431
-
You can also use `uv <https://docs.astral.sh/uv/getting-started/>`__ as you wish.
459
+
You can also use `uv <https://docs.astral.sh/uv/getting-started/>`__ if you wish.
432
460
433
461
434
462
Editor
@@ -445,32 +473,10 @@ An editor you can use is `ReText <https://github.com/retext-project/retext>`__ b
445
473
$ pip3 install ReText
446
474
447
475
448
-
Configuration
449
-
-------------
450
-
451
-
Qubes-doc directory contains a build configuration file named :file:`conf.py`, used by Sphinx
452
-
to define `input and output behaviour <https://www.sphinx-doc.org/en/master/usage/configuration.html>`__.
453
-
It contains settings and extensions that define how the documentation will be generated.
454
-
455
-
You can find it `here <https://github.com/QubesOS/qubes-doc/blob/rst/conf.py>`__.
456
-
457
-
You can also find a :file:`readthedocs.yml` `file <https://github.com/QubesOS/qubes-doc/blob/rst/.readthedocs.yaml>`__
458
-
which tells RTD how to build the documentation. It defines the build environment, Python version, required dependencies,
459
-
and which Sphinx configuration to run. Thus RTD automatically generates and hosts the docs.
460
-
461
-
462
-
Extensions
463
-
----------
464
-
465
-
We use several Sphinx `extensions <https://www.sphinx-doc.org/en/master/usage/extensions/index.html>`__
466
-
as defined in :file:`conf.py`, as well a simple custom one to embed YouTube videos,
467
-
which can be found `here <https://github.com/QubesOS/qubes-doc/tree/rst/_ext>`__.
468
-
469
-
470
476
Security
471
477
========
472
478
473
-
Also see: :ref:`FAQ: Why is the documentation hosted on ReadTheDocs as opposed to the website? <introduction/faq:why is the documentation hosted on readthedocs as opposed to the website?>`.
479
+
Also see: :ref:`FAQ: Why is the documentation hosted on ReadTheDocs as opposed to the website? <introduction/faq:why is the documentation hosted on readthedocs as opposed to the website?>`
474
480
475
481
All pull requests (PRs) against `qubes-doc <https://github.com/QubesOS/qubes-doc>`__ must pass review
476
482
prior to be merged, except in the case of :ref:`external documentation <index:external documentation>`
@@ -533,3 +539,5 @@ you are not willing or able to do so.)
533
539
:alt:Highlights the View Docs button in a specific build for a pull request <number> on RTD
0 commit comments