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
Docs: Refactor the build & build customization pages (Diátaxis) (#10028)
* Refactor the build & build customization pages
This mostly was just cleanup,
and didn't change the structure of these pages.
I do think we want to break out the examples into a seperate page in the future,
but I just wanted an initial refactor here..
Fixes#9575
* Fix up titles
* Update docs/user/build-customization.rst
* Apply suggestions from code review
Co-authored-by: Benjamin Balder Bach <[email protected]>
* Apply suggestions from code review
---------
Co-authored-by: Benjamin Balder Bach <[email protected]>
Copy file name to clipboardExpand all lines: docs/user/build-customization.rst
+69-62
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,30 @@
1
-
Build customization
2
-
===================
1
+
Build process customization
2
+
===========================
3
3
4
-
Read the Docs has a :doc:`well-defined build process <builds>` that works for many projects,
5
-
but we offer additional customization to support more uses of our platform.
6
-
This page explains how to extend the build process using :term:`user-defined build jobs` to execute custom commands,
7
-
and also how to override the build process completely:
4
+
Read the Docs has a :doc:`well-defined build process </builds>` that works for many projects.
5
+
We also allow customization of builds in primary ways:
8
6
9
7
`Extend the build process`_
10
-
If you are using Sphinx or Mkdocs and need to execute additional commands.
8
+
Keep using the default build process,
9
+
adding your own commands.
11
10
12
11
`Override the build process`_
13
-
If you want full control over your build. This option supports any tool that generates HTML as part of the build.
14
-
15
-
.. contents:: Table of contents
16
-
:local:
12
+
This option gives you *full control* over your build.
13
+
Read the Docs supports any tool that generates HTML.
17
14
18
15
Extend the build process
19
16
------------------------
20
17
21
18
In the normal build process,
22
19
the pre-defined jobs ``checkout``, ``system_dependencies``, ``create_environment``, ``install``, ``build`` and ``upload`` are executed.
23
-
However, Read the Docs exposes extra jobs to users so they can customize the build process by running shell commands.
24
-
These extra jobs are:
20
+
Read the Docs also exposes these jobs,
21
+
which allows you to customize the build process by adding shell commands.
22
+
23
+
The jobs where users can customize our default build process are:
25
24
26
25
.. list-table::
27
26
:header-rows: 1
27
+
:widths: 25 75
28
28
29
29
* - Step
30
30
- Customizable jobs
@@ -39,23 +39,22 @@ These extra jobs are:
39
39
* - Build
40
40
- ``pre_build``, ``post_build``
41
41
* - Upload
42
-
- There are no customizable jobs currently
42
+
- No customizable jobs currently
43
43
44
44
.. note::
45
45
46
-
Currently, the pre-defined jobs (``checkout``, ``system_dependencies``, etc) executed by Read the Docs cannot be overridden or skipped.
47
-
46
+
The pre-defined jobs (``checkout``, ``system_dependencies``, etc) cannot be overridden or skipped.
47
+
You can fully customize things in :ref:`build-customization:override the build process`.
48
48
49
-
These jobs can be declared by using a :doc:`/config-file/index` with the :ref:`config-file/v2:build.jobs` key on it.
50
-
Let's say the project requires commands to be executed *before* installing any dependency into the Python environment and *after* the build has finished.
51
-
In that case, a config file similar to this one can be used:
49
+
These jobs are defined using the :doc:`/config-file/v2` with the :ref:`config-file/v2:build.jobs` key.
50
+
This example configuration defines commands to be executed *before* installing and *after* the build has finished:
52
51
53
52
.. code-block:: yaml
54
53
:caption: .readthedocs.yaml
55
54
56
55
version: 2
57
56
build:
58
-
os: "ubuntu-20.04"
57
+
os: "ubuntu-22.04"
59
58
tools:
60
59
python: "3.10"
61
60
jobs:
@@ -67,7 +66,8 @@ In that case, a config file similar to this one can be used:
It's possible to run Doxygen as part of the build process to generate documentation from annotated sources:
176
176
@@ -190,7 +190,7 @@ It's possible to run Doxygen as part of the build process to generate documentat
190
190
191
191
192
192
Use MkDocs extensions with extra required steps
193
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
194
194
195
195
There are some MkDocs extensions that require specific commands to be run to generate extra pages before performing the build.
196
196
For example, `pydoc-markdown <http://niklasrosenstein.github.io/pydoc-markdown/>`_
@@ -209,7 +209,7 @@ For example, `pydoc-markdown <http://niklasrosenstein.github.io/pydoc-markdown/>
209
209
210
210
211
211
Avoid having a dirty Git index
212
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
213
213
214
214
Read the Docs needs to modify some files before performing the build to be able to integrate with some of its features.
215
215
Because of this reason, it could happen the Git index gets dirty (it will detect modified files).
@@ -231,7 +231,7 @@ In that case, the Git index can be updated to ignore the files that Read the Doc
231
231
232
232
233
233
Perform a check for broken links
234
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
234
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
235
235
236
236
Sphinx comes with a `linkcheck <https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.linkcheck.CheckExternalLinksBuilder>`_ builder that checks for broken external links included in the project's documentation.
237
237
This helps ensure that all external links are still valid and readers aren't linked to non-existent pages.
@@ -251,7 +251,7 @@ This helps ensure that all external links are still valid and readers aren't lin
251
251
252
252
253
253
Support Git LFS (Large File Storage)
254
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
254
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
255
255
256
256
In case the repository contains large files that are tracked with Git LFS,
257
257
there are some extra steps required to be able to download their content.
@@ -284,7 +284,7 @@ It's possible to use ``post_checkout`` user-defined job for this.
284
284
285
285
286
286
Install Node.js dependencies
287
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
287
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
288
288
289
289
It's possible to install Node.js together with the required dependencies by using :term:`user-defined build jobs`.
290
290
To setup it, you need to define the version of Node.js to use and install the dependencies by using ``build.jobs.post_install``:
@@ -307,7 +307,7 @@ To setup it, you need to define the version of Node.js to use and install the de
307
307
308
308
309
309
Install dependencies with Poetry
310
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
311
311
312
312
Projects managed with `Poetry <https://python-poetry.org/>`__,
313
313
can use the ``post_create_environment`` user-defined job to use Poetry for installing Python dependencies.
@@ -344,30 +344,53 @@ Override the build process
344
344
345
345
.. warning::
346
346
347
-
This feature is in a *beta phase* and could suffer incompatible changes or even removed completely in the near feature.
348
-
It does not yet support some of the Read the Docs' features like the :term:`flyout menu`, and ads.
349
-
However, we do plan to support these features in the future.
350
-
Use this feature at your own risk.
351
-
347
+
This feature is in *beta* and could change without warning.
348
+
It does not yet support some of the Read the Docs' features like the :term:`flyout menu`.
349
+
We do our best to not break existing configurations,
350
+
but use this feature at your own risk.
352
351
353
352
If your project requires full control of the build process,
354
353
and :ref:`extending the build process <build-customization:extend the build process>` is not enough,
355
-
all the commands executed during builds can be overridden using the :ref:`config-file/v2:build.commands` configuration file key.
354
+
all the commands executed during builds can be overridden using the :ref:`config-file/v2:build.commands`.
356
355
357
356
As Read the Docs does not have control over the build process,
358
-
you are responsible for running all the commands required to install requirements and build your project properly.
359
-
Once the build process finishes, the contents of the ``_readthedocs/html/`` directory will be hosted.
357
+
you are responsible for running all the commands required to install requirements and build your project.
358
+
359
+
Where to put files
360
+
~~~~~~~~~~~~~~~~~~
360
361
362
+
It is your responsibility to generate HTML and other formats of your documentation using :ref:`config-file/v2:build.commands`.
363
+
The contents of the ``_readthedocs/<format>/`` directory will be hosted as part of your documentation.
364
+
365
+
Supported :ref:`formats <downloadable-documentation:accessing offline formats>` are published if they exist in the following directories:
366
+
367
+
* ``_readthedocs/html/`` (required)
368
+
* ``_readthedocs/htmlzip/``
369
+
* ``_readthedocs/pdf/``
370
+
* ``_readthedocs/epub/``
371
+
372
+
Search support
373
+
~~~~~~~~~~~~~~
374
+
375
+
Read the Docs will automatically index the content of all your HTML files,
376
+
respecting the :ref:`search <config-file/v2:search>` option.
377
+
378
+
You can access the search from the Read the Docs :term:`dashboard`,
379
+
or by using the :doc:`/server-side-search/api`.
380
+
381
+
.. note::
382
+
383
+
In order for Read the Docs to index your HTML files correctly,
384
+
they should follow the conventions described at :doc:`rtd-dev:search-integration`.
361
385
362
386
``build.commands`` examples
363
-
+++++++++++++++++++++++++++
387
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
364
388
365
-
This section contains some examples that showcase what is possible with :ref:`config-file/v2:build.commands`.
389
+
This section contains examples that showcase what is possible with :ref:`config-file/v2:build.commands`.
366
390
Note that you may need to modify and adapt these examples depending on your needs.
367
391
368
-
369
392
Pelican
370
-
~~~~~~~
393
+
^^^^^^^
371
394
372
395
`Pelican <https://blog.getpelican.com/>`__ is a well-known static site generator that's commonly used for blogs and landing pages.
373
396
If you are building your project with Pelican you could use a configuration file similar to the following:
@@ -386,7 +409,7 @@ If you are building your project with Pelican you could use a configuration file
386
409
387
410
388
411
Docsify
389
-
~~~~~~~
412
+
^^^^^^^
390
413
391
414
`Docsify <https://docsify.js.org/>`__ generates documentation websites on the fly, without the need to build static HTML.
392
415
These projects can be built using a configuration file like this:
@@ -402,19 +425,3 @@ These projects can be built using a configuration file like this:
402
425
commands:
403
426
- mkdir --parents _readthedocs/html/
404
427
- cp --recursive docs/* _readthedocs/html/
405
-
406
-
407
-
Search support
408
-
++++++++++++++
409
-
410
-
Read the Docs will automatically index the content of all your HTML files,
411
-
respecting the :ref:`search <config-file/v2:search>` options from your config file.
412
-
413
-
You can access the search results from the :guilabel:`Search` tab of your project,
414
-
or by using the :doc:`/server-side-search/api`.
415
-
416
-
.. note::
417
-
418
-
In order for Read the Docs to index your HTML files correctly,
419
-
they should follow some of the conventions described
0 commit comments