Commit Graph

1506 Commits

Author SHA1 Message Date
Waylan Limberg
24f7e12efb Replace pgk_resources.parse_version with packaging.version.parse
This removes the final dependency in pkg_resources. Closes #2347.
2021-04-06 16:26:59 -04:00
Waylan Limberg
ec64ab40a5 Replace pkg_resources with importlib_metadata
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).
2021-04-06 11:51:45 -04:00
Waylan Limberg
21b3d1d431 Ensure each instance of Config is unique
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.
2021-04-05 18:48:59 -04:00
Waylan Limberg
a118183f5e Refactor docs (#2344)
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.
2021-04-04 16:14:29 -04:00
Oleh Prypin
fe6a389dae Exclude edge cases where get_relative_url depends on CWD (#2296)
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.
2021-04-04 15:21:16 -04:00
Andre_601
fd5a890578 Refactor Readme and use for long_description
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.
2021-03-29 10:22:44 -04:00
Andre_601
41c9961de5 Link to GitHub discussions (#2334)
Related to #2256. Also remove link to unused IRC channel.
2021-03-25 13:39:42 -04:00
Masanori Matsumoto
aa20a9d086 Fix support for ja or jp in search. (#2178)
Add tinyseg.js included with lunr-languages v1.4.0. Fixes `MODULE_NOT_FOUND` error when lang is `ja` or `jp`.
2021-03-24 19:38:33 -04:00
Ginger Old
dd903d3092 Upgrade highlightjs to 10.5.0 for better code highlighting
Closes #2312.
2021-02-28 17:01:13 -05:00
Mick Orbik
4faa18d095 Added configuration for search indexing strategy (#2309)
Allows a user to supply a `indexing` configuration to the search
plugin which controls what to include in the search index (full,
sections, titles)
2021-02-21 15:05:14 -05:00
Ultrabug
b1f5dae055 files structure: move src_paths as a dynamic property, add remove
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
2021-02-16 15:16:22 -05:00
Ultrabug
e65c7660ad config_options: display the name of the plugin failing validation
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
2021-02-15 11:21:08 -05:00
Oleh Prypin
47a5d55232 Avoid a race condition creating the subdirectory for a site file
It is possible that this directory does not exist when checking but already exists when trying to create it.
2021-02-15 11:17:05 -05:00
Oleh Prypin
b5cfce7bd1 Skip duplicated error message when omitting the traceback
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.
2021-02-10 15:25:01 -05:00
Salar Nosrati-Ershad
269ec0857a Update to use Click's building version option formatting
* Modify the syntax of version option and checking python version
* Remove version check as our move to Python 3 was some time ago.
2021-01-13 09:46:31 -05:00
decaby7e
520314fed9 Typo correction 2020-12-27 15:14:43 -05:00
Timothée Mazzucotelli
3c9358bb6a Add plugin error exception and event
Related to #2082.
2020-12-23 19:23:31 -05:00
Oleh Prypin
d094c932d3 search: Merge two HTML parsers into one
This improves performance, as HTML of each page doesn't need to be parsed twice.
2020-12-23 15:20:14 -05:00
Waylan Limberg
f4de3c7387 Support Environment Variables in config file
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
2020-12-23 13:02:21 -05:00
Oleh Prypin
30dc6a0ef7 Avoid re-querying the list of pages
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
2020-12-22 17:48:09 -05:00
Oleh Prypin
31c6ec546d Don't needlessly encode a string
This appears to be a holdover from Py2.
2020-12-22 17:42:25 -05:00
Oleh Prypin
c5e4018f04 Disable Jinja's internal auto_reload
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
2020-12-21 20:51:43 -05:00
Waylan Limberg
c7d86d4989 Support PY39 and drop PY35 (#2260)
PyYAML 3.13 fails to install on PY3.9 on MacOS. The next public release was 5.1.
2020-12-21 16:31:38 -05:00
Waylan Limberg
5c2b4f1353 Update ghp_import dependency to 1.0
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.
2020-12-21 14:02:02 -05:00
Oleh Prypin
56f98cb722 Optimize/simplify __eq__ implementations
(this has proven to be very significant in profiling)
2020-12-21 08:55:18 -05:00
Oleh Prypin
1b954c6022 Cache results of normalize_url for a performance boost
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.
2020-12-21 08:52:13 -05:00
SaintMalik
bd73399f55 Fix broken url in docs
## Summary

Easy navigation and easy reading for others
2020-12-17 13:18:43 -05:00
Tim Vink
3e8b3481ff Remove sidebar when printing (#2193) 2020-12-07 14:28:15 -05:00
DJ Adams
2f833a1a29 Make clear the distinction between and use of docs_dir and docs (#2230) 2020-11-20 10:59:53 -05:00
AleksaC
7dc35a11ad Reintroduce pypy to CI 2020-11-16 09:17:20 -05:00
Waylan Limberg
2d8e9d3305 Remove links to specific hosts from Getting Started Guide
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.
2020-11-06 11:58:44 -05:00
Waylan Limberg
f73f221f1f Add --wait flag to serve command.
Fixes #2061.
2020-11-06 10:27:11 -05:00
Waylan Limberg
51418b9226 Update build status badge to point to GitHub Action 2020-11-05 15:27:44 -05:00
Waylan Limberg
725371c946 Temporarily exclude Windows/PyPy check
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.
2020-11-05 15:04:06 -05:00
Waylan Limberg
e28c20223b Switch to GitHub Actions from Travis/Appveyor
This duplicates everything we already had in Travis and Appveyor.
Any additional actions can be added separately later.
2020-11-05 15:04:06 -05:00
Waylan Limberg
0080e189db Release-notes cleanup 2020-11-04 09:12:32 -05:00
Waylan Limberg
07c403d852 Bump version to 1.2.dev 2020-11-03 14:19:29 -05:00
Waylan Limberg
96d1e230fa Exclude theme from watched files by default.
Add a --watch-theme option which theme devs can enable if needed.
Most users never modify the theme files and watchers are resource hogs.
Fixes #2092.
2020-11-03 14:19:29 -05:00
Lukas Geiter
00b62aa144 Fix _get_by_type for Section 2020-10-28 11:00:21 -04:00
Viktor Ahlqvist
b50f32f1c6 Add trove classifier for Python 3.8 2020-10-27 15:01:53 -04:00
Karthikeyan Singaravelan
72f506dcce Import ABC from collections.abc explicitly. 2020-10-27 14:50:56 -04:00
Lukas Geiger
0e6fc52624 Prefer list comprehensions over list.append() 2020-10-27 14:41:40 -04:00
Dmitry Shachnev
d6f53c85e2 Remove unused glyphicons files
They seem to be remnants from Bootstrap 3 times, now MkDocs theme is using
Font Awesome.
2020-10-27 14:32:54 -04:00
PoojaChandak
eba0bc51e1 Update configuration.md
Observed a few changes. Suggesting the same.
2020-10-27 14:31:04 -04:00
Chris McCafferty
22537dabac Fix a typo 2020-10-27 14:29:41 -04:00
Justin M
b440c4b923 Fixing broken internal anchor link 2020-10-27 14:27:28 -04:00
Tim Vink
b97b658f7b Fix typo 2020-10-27 14:26:35 -04:00
Peter Bajurny
aba9dbffcf Fix relative link to Index Pages in Writing Your Docs help page
The link links to `index_pages` with an underscore but the page as currently rendered has that link as `index-pages` with a hyphen.
2020-10-27 14:22:54 -04:00
Tim Vink
2d9d565712 Add link to Jinja environment class
Helpful for plugin developers
2020-10-27 14:22:00 -04:00
Waylan Limberg
ff0b726056 Bump version to 1.1.2. 1.1.2 2020-05-14 11:07:56 -04:00