This is using the new "selection interface" ( by calling `entry_points` with
the `group` parameter) that is being introduced in `importlib.metadata` of
Python 3.10 (currently in alpha). While the backport (`importlib_metadata`)
introduced the same change in version 3.6, various improvements have been made
up through the current release (3.10). Therefore we require
`importlib_metadata>=3.10` for all supported versions of Python (3.6-3.9).
Replace the global variable `mkdocs.config.DEFAULT_SCHEMA` with
the function `mkdocs.config.defaults.get_schema()`. An instance is no
longer created on import (eliminating circular imports under certain
circumstances) and each call to `get_schema()` builds a new instance
of each object. Fixes#2289.
The homepage has been redesigned. The "Installation" and "Getting Started" sections were moved to their own respective pages. Then, the homepage was restyled so that the list of features appear as a grid of cards.
The developer specific pages were moved to a new section: `dev-guide`. Any old URLs redirect to the new ones.
When only one of the two passed paths starts with a slash, this function would produce results that depend on (and expose parts of) the actual current working directory.
In a similar manner, it was also possible to "break out" of the "current directory" by starting one of the paths with `../../..` etc.
Additionally, the fact that paths always end up being resolved relative to the current working directory made this function less efficient than it needs to be.
Fun fact: `get_relative_url('path_a', 'path_b')` actually ended up looking up how to get to `/current/working/directory/path_a` from `/current/working/directory/path_b`.
Luckily, none of these behaviors can ever actually come into effect (the function is always called without a leading slash and without paths deliberately trying to escape), but the fix is still good to reduce surprise.
*The actual fix* is that we make the leading slash ignored (or quite the opposite - we always add it).
Now when either of the two arguments try to go up higher than the top level, they just end up at the top level (e.g. `foo/../..` is effectively `.`), only then the "relative" calculation happens.
Improve readme with a different structure and some link changes.
The landscape.io links have been removed as that project seems
discontinued since April 2020.
With `long_description_content_type="text/markdown"` it is possible
to use Markdown text in the `long_description` meta-data field. Make sure
the latest tools (setuptools, wheel, twine) are installed before deploying.
Plugins wishing to manipulate the Files structure have an append
method but can't dynamically work on src_paths since it's computed
once on Files instanciation
This commits allows plugins to manipulate Files trough append and
remove of file objects while not having to care about the src_paths
since it's now a dynamically computed property
When a parameter value validation fails for a plugin the name of
the failing plugin is not displayed
This commit adds the name of the plugin in the error message for
completeness
The new BuildError exception is good for skipping the traceback, but if it's skipped, now the two copies of the error mesage (one from logging, one from reaching SystemExit) immediately follow each other, which looks strange.
So, skip logging the exception's message when encountering a BuildError in _populate_page and _build_page.
Environment variables can be assigned as values in the configuration
file using the !ENV tag. Resolves#1954.
The behavior is defined in the third-party package pyyaml_env_tag:
https://github.com/waylan/pyyaml-env-tag
The list of pages now gets formed a constant number of times within a mkdocs build, instead of recreating the list for every page.
For compatibility (if someone happened to use this function externally), one can still pass a `Files` to get_context, but its main mode of operation is now to accept a direct list of `File`s
MkDocs templates are quite heavily split into files and can even be nested [1] (particularly for navs, which also repeat on every page).
Any time a template is referenced, even though it's cached in memory, Jinja ends up doing a filesystem access, to check whether the template file has been modified and so would need to be recompiled.
But it's not even useful to be able to modify a template file on disk in the middle of a mkdocs build.
So, by disabling autoreload, we eliminate all these filesystem accesses (on the order of thousands), other than the initial one per template.
[1]: https://github.com/mkdocs/mkdocs/blob/master/mkdocs/themes/mkdocs/nav-sub.html
Replace vendored (and modified) copy of ghp_import with dependency on
upstream library. As of version 1.0+ ghp_import includes a Python API.
MkDocs can now benefit from recent bug fixes and new features, including the following:
* A `.nojekyll` file is automatically included when deploying to GitHub Pages.
* The `--shell` flag is now available, which reportedly works better on Windows.
* Git author and committer environment variables should be respected.
Resolves#2170 and resolves#1383.
I have profiled a sample website and got its build time from ~27s to ~24s.
I split up the function, investigated in detail which parts of it benefit from caching (also from unlimited vs limited cache size) and configured it accordingly.
We already link to the Deploying for Docs page which includes specific
instructions for various hosts. There is no need to also link to those
hosts in the Getting Started guide.
Closes#2210, closes#2104, closes#1890.
Due to a bug in PyPy 3.6.9 on Windows, tox is not able to start up and run.
See tox-dev/tox#1704 for details. Revert this when PyPy is updated to
the next release and/or when the bug is fixed upstream.