Skip to content

Commit 7147ac5

Browse files
committed
Guide explaining how to keep compatibility with mkdocs
1 parent 183b176 commit 7147ac5

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

docs/guides/mkdocs-old-versions.rst

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
Keep Building Docs With Old Version Of MkDocs
2+
=============================================
3+
4+
Recent changes on ``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+
Upgrade your custom theme to be compatible with newer mkdocs versions
37+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38+
39+
It is possible that event your build passes your documentation doesn't look correct.
40+
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.
41+
42+
You should check the `mkdocs' Custom Theme documentation`_ to upgrade your custom theme and make it compatible with the new version.
43+
44+
.. _mkdocs' Custom Theme documentation: https://www.mkdocs.org/user-guide/custom-themes/
45+
46+
47+
Upgrade how extension arguments are defined
48+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49+
50+
``mkdocs`` has changed the way that ``markdown_extensions`` are defined and you may need to upgrade it.
51+
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.
52+
53+
For example, this definition:
54+
55+
.. code-block:: yaml
56+
57+
markdown_extensions:
58+
- admonition
59+
- codehilite(guess_lang=false)
60+
- toc(permalink=true)
61+
- footnotes
62+
- meta
63+
64+
needs to be replaced by:
65+
66+
.. code-block:: yaml
67+
68+
markdown_extensions:
69+
- admonition
70+
- codehilite
71+
guess_lang: false
72+
- toc
73+
permalink: true
74+
- footnotes
75+
- meta

0 commit comments

Comments
 (0)