| 1 |
Installation |
| 2 |
============ |
| 3 |
|
| 4 |
How to install and use the theme |
| 5 |
-------------------------------- |
| 6 |
|
| 7 |
Install the ``sphinx_rtd_theme`` package (or add it to your ``requirements.txt`` file): |
| 8 |
|
| 9 |
.. code:: console |
| 10 |
|
| 11 |
$ pip install sphinx_rtd_theme |
| 12 |
|
| 13 |
In your Sphinx project's ``conf.py`` file, add ``sphinx_rtd_theme`` to the list of enabled extensions and as the active theme: |
| 14 |
|
| 15 |
.. code:: python |
| 16 |
|
| 17 |
extensions = [ |
| 18 |
... |
| 19 |
'sphinx_rtd_theme', |
| 20 |
] |
| 21 |
|
| 22 |
html_theme = "sphinx_rtd_theme" |
| 23 |
|
| 24 |
.. seealso:: |
| 25 |
:ref:`supported-browsers` |
| 26 |
Officially supported and tested browser/operating system combinations |
| 27 |
|
| 28 |
:ref:`supported-dependencies` |
| 29 |
Officially Supported versions of Python, Sphinx, and other dependencies. |
| 30 |
|
| 31 |
|
| 32 |
.. note:: |
| 33 |
|
| 34 |
Adding this theme as an extension activates the ``sphinxcontrib-jquery`` extension, |
| 35 |
which is required for search, smooth scrolling, and the flyout menu. |
| 36 |
If any of these features don't work, make sure you have the theme declared in your ``extensions``. |
| 37 |
|
| 38 |
.. More context for this note: |
| 39 |
* https://github.com/readthedocs/sphinx_rtd_theme/issues/1434#issuecomment-2288359582 |
| 40 |
* https://github.com/readthedocs/sphinx_rtd_theme/issues/1222#issuecomment-2296703160 |
| 41 |
|
| 42 |
|
| 43 |
.. _howto_upgrade: |
| 44 |
|
| 45 |
How to upgrade |
| 46 |
-------------- |
| 47 |
|
| 48 |
Adding ``sphinx-rtd-theme`` to your project's dependencies will make pip install the latest compatible version of the theme. |
| 49 |
|
| 50 |
If you want to test a **pre-release**, you need to be explicit about the version you specify. |
| 51 |
Otherwise, pip will ignore pre-releases. Add for instance ``sphinx-rtd-theme==1.1.0b3`` to test a pre-release. |
| 52 |
|
| 53 |
.. tip:: |
| 54 |
We recommend that you pin the version of Sphinx that your project is built with. |
| 55 |
We won't release sphinx-rtd-theme without marking its compatibility with Sphinx. So if you do not pin ``sphinx-rtd-theme`` itself, you will always get the *latest compatible* release. |
| 56 |
|
| 57 |
More information is available in Read the Docs' documentation on :doc:`rtd:guides/reproducible-builds`. |
| 58 |
|