Skip to content

Commit 8c7e18d

Browse files
authored
Merge pull request #4726 from rtfd/humitos/guides/mkdocs-old-version
Guide explaining how to keep compatibility with mkdocs
2 parents cd994c2 + b2be853 commit 8c7e18d

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

docs/builds.rst

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ and MkDocs will build the ``.md`` files in that directory.
5656
As MkDocs doesn't support automatic PDF generation,
5757
Read the Docs cannot create a PDF version of your documentation with the *Mkdocs* option.
5858

59+
.. warning::
60+
61+
We strongly recommend to :ref:`pin the MkDocs version <guides/specifying-dependencies:Specifying Dependencies>`
62+
used for your project to build the docs to avoid potential future incompatibilities.
63+
64+
5965
Understanding what's going on
6066
-----------------------------
6167

docs/guides/mkdocs-old-versions.rst

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Keep Building Docs With Old Version Of MkDocs
2+
=============================================
3+
4+
Recent changes to ``mkdocs`` forced us to `upgrade the default version installed`_ by Read the Docs and this may be a breaking change for your documentation.
5+
6+
.. _upgrade the default version installed: https://github.com/rtfd/readthedocs.org/pull/4041
7+
8+
You should check that your docs continue building in any of these cases:
9+
10+
* your project doesn't have a ``requirements.txt`` file pinning ``mkdocs`` to a specific version
11+
* your project is using a custom theme
12+
* your project is using Markdown extensions
13+
14+
In case your builds are failing because of a ``mkdocs`` issue,
15+
you may want to follow one of the following solutions depending on the case.
16+
17+
18+
Pin mkdocs to the previous version
19+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
21+
Before Read the Docs upgraded its default version installed, ``mkdocs==0.15.0`` was used.
22+
To make your project continue using this version you will need to create a ``requirements.txt`` file with this content::
23+
24+
# requirements.txt
25+
mkdocs==0.15.0
26+
mkdocs-bootstrap==0.1.1
27+
mkdocs-bootswatch==0.1.0
28+
29+
.. note::
30+
31+
Most of the breaking changes where introduced in ``mkdocs==0.17``,
32+
so you may want to test only pinning ``mkdocs`` to ``mkdocs<0.17``
33+
and check if your docs keep building successfully.
34+
35+
36+
More detailed information about how to specify dependencies can be found :ref:`here <guides/specifying-dependencies:Specifying Dependencies>`.
37+
38+
39+
Upgrade your custom theme to be compatible with newer mkdocs versions
40+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41+
42+
It is possible that event your build passes your documentation doesn't look correct.
43+
This may be because the new ``mkdocs==0.17.3`` version installed by Read the Docs introduced some breaking changes on the structure of the theme.
44+
45+
You should check the `mkdocs' Custom Theme documentation`_ to upgrade your custom theme and make it compatible with the new version.
46+
47+
.. _mkdocs' Custom Theme documentation: https://www.mkdocs.org/user-guide/custom-themes/
48+
49+
50+
Upgrade how extension arguments are defined
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52+
53+
``mkdocs`` has changed the way that ``markdown_extensions`` are defined and you may need to upgrade it.
54+
If you where passing arguments to the extension by defining them between brackets (``toc(permalink=true)``) in your ``mkdocs.yaml`` you may need to upgrade it to the new way.
55+
56+
For example, this definition:
57+
58+
.. code-block:: yaml
59+
60+
markdown_extensions:
61+
- admonition
62+
- codehilite(guess_lang=false)
63+
- toc(permalink=true)
64+
- footnotes
65+
- meta
66+
67+
needs to be replaced by:
68+
69+
.. code-block:: yaml
70+
71+
markdown_extensions:
72+
- admonition
73+
- codehilite
74+
guess_lang: false
75+
- toc
76+
permalink: true
77+
- footnotes
78+
- meta

0 commit comments

Comments
 (0)