-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Guide explaining how to keep compatibility with mkdocs #4726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
Keep Building Docs With Old Version Of MkDocs | ||
============================================= | ||
|
||
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. | ||
|
||
.. _upgrade the default version installed: https://github.com/rtfd/readthedocs.org/pull/4041 | ||
|
||
You should check that your docs continue building in any of these cases: | ||
|
||
* your project doesn't have a ``requirements.txt`` file pinning ``mkdocs`` to a specific version | ||
* your project is using a custom theme | ||
* your project is using Markdown extensions | ||
|
||
In case your builds are failing because of a ``mkdocs`` issue, | ||
you may want to follow one of the following solutions depending on the case. | ||
|
||
|
||
Pin mkdocs to the previous version | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Before Read the Docs upgraded its default version installed, ``mkdocs==0.15.0`` was used. | ||
To make your project continue using this version you will need to create a ``requirements.txt`` file with this content:: | ||
|
||
# requirements.txt | ||
mkdocs==0.15.0 | ||
mkdocs-bootstrap==0.1.1 | ||
mkdocs-bootswatch==0.1.0 | ||
|
||
.. note:: | ||
|
||
Most of the breaking changes where introduced in ``mkdocs==0.17``, | ||
so you may want to test only pinning ``mkdocs`` to ``mkdocs<0.17`` | ||
and check if your docs keep building successfully. | ||
|
||
|
||
More detailed information about how to specify dependencies can be found :ref:`here <guides/specifying-dependencies:Specifying Dependencies>`. | ||
|
||
|
||
Upgrade your custom theme to be compatible with newer mkdocs versions | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
It is possible that event your build passes your documentation doesn't look correct. | ||
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. | ||
|
||
You should check the `mkdocs' Custom Theme documentation`_ to upgrade your custom theme and make it compatible with the new version. | ||
|
||
.. _mkdocs' Custom Theme documentation: https://www.mkdocs.org/user-guide/custom-themes/ | ||
|
||
|
||
Upgrade how extension arguments are defined | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
``mkdocs`` has changed the way that ``markdown_extensions`` are defined and you may need to upgrade it. | ||
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. | ||
|
||
For example, this definition: | ||
|
||
.. code-block:: yaml | ||
|
||
markdown_extensions: | ||
- admonition | ||
- codehilite(guess_lang=false) | ||
- toc(permalink=true) | ||
- footnotes | ||
- meta | ||
|
||
needs to be replaced by: | ||
|
||
.. code-block:: yaml | ||
|
||
markdown_extensions: | ||
- admonition | ||
- codehilite | ||
guess_lang: false | ||
- toc | ||
permalink: true | ||
- footnotes | ||
- meta |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually couldn't find exactly where this syntax changed. I tested building docs with the old method in 0.15 and they still didn't build. Maybe this was a change in a markdown parser? I'm not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you pin
Markdown
also to some version? I didn't, and I had to upgrade this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Maybe this changed underneath mkdocs.