1565 Commits

Author SHA1 Message Date
Oleh Prypin
52ed45a58c Release 1.2.2 (#2496) 1.2.2 2021-07-18 21:17:36 +02:00
Oleh Prypin
1c72c12472 Don't announce support of zh_CN locale yet, as there's a bug (#2510)
https://github.com/mkdocs/mkdocs/issues/2509
2021-07-18 20:57:54 +02:00
Oleh Prypin
1b15412f4c Don't require trailing slash when serving a directory index (#2507)
in the livereload/local server.

Instead of showing a 404 error, detect if it's a directory and redirect to a path with a trailing slash added
2021-07-18 17:08:21 +02:00
Oleh Prypin
e0ba6d7bd9 Tighten the docs and tests around site_url (#2506)
Some of the docs were accidentally reverted with other things, so I'm restoring them and adding a bit more.

Fixing an edge case: it is in fact possible to specify a URL with scheme and without netloc. Adding new tests to also catch that.
2021-07-17 03:11:30 +02:00
Ultrabug
ccc4ce8d13 Merge pull request #2497 from xingkong0113/zh_CN
zh_CN: Complete the translation of the mkdocs theme
2021-07-15 11:19:07 +02:00
xingkong0113
8091fab09d Merge branch 'master' into zh_CN 2021-07-15 15:53:55 +08:00
Oleh Prypin
6f5443caee CI: Run all lint checks in one job (#2501)
This is more considerate of the computational resources. The lint checks are not the bottleneck, and now they won't starve other jobs from starting.
All checks will still run and a failure in any of them will fail the job.

Also upgrade Python and Node versions

+ Remove unused 'max-parallel'
2021-07-14 22:02:15 +02:00
Oleh Prypin
fd0e9dedd2 Replace urlparse with urlsplit (#2502)
https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlsplit

It's the same but doesn't treat ';' as a special character in paths; and I don't think anyone would expect it to be special
2021-07-14 22:01:33 +02:00
xingkong0113
b4a471b684 Merge branch 'master' into zh_CN 2021-07-14 06:19:42 +08:00
xingkong0113
0a7e707129 add "Last-Translator: >
Add translator name and email
2021-07-14 06:11:46 +08:00
Oleh Prypin
b12804d97e Fix some spelling typos (#2489) 2021-07-13 19:07:59 +02:00
xingkong0113
c257235204 Update Docs 2021-07-13 20:06:32 +08:00
xingkong0113
a29c337f2d zh_CN
Finish translating both mkdocs and readthedocs topics.

Signed-off-by: xingkong0113 <26911141+xingkong0113@users.noreply.github.com>
2021-07-13 11:02:28 +08:00
Oleh Prypin
ae556572d4 Revert "Ensure site_url and use_directory_urls do not conflict." (#2490)
This reverts commit b89ec5792e.

That commit claims to fix some bugs in interactions with `use_directory_urls`, but in fact there are currently no known unfixed bugs.
So there is no need to have that breaking change.
2021-07-12 22:26:04 +02:00
Urs Liska
47d7571697 Add link to README to contributing.md (#1978)
In https://github.com/mkdocs/mkdocs/issues/1972#issuecomment-582952604
I was pointed to the README, but I hadn't looked for contact information there.
I think looking on the website is a reasonable way, and pointing to the README
from the "Contributing" page looks like a good help to me.
2021-07-08 23:43:20 +02:00
Oleh Prypin
cdb1f7107a Revert livereload file watching to use polling observer (#2477)
This goes back to the approach that was always used with 'livereload' library (but now just using the 'watchdog' implementation of the same), meaning the same downsides with latency and CPU usage.
But we have to do this to reasonably support usages that span virtual filesystems such as non-native Docker and network mounts.

This also simplifies the code, as the polling observer already follows symlinks and happens to support watching paths of files directly
2021-07-08 18:32:36 +02:00
Oleh Prypin
06d8b4742c Allow mkdocs.yaml when '--config' is not passed + refactor (#2478)
Co-authored-by: Olaf Gladis <olaf.gladis@trivago.com>
2021-07-08 18:29:55 +02:00
Oleh Prypin
f6d883035a Optimize getting relative page URLs (#2407)
This is a custom implementation that's significantly faster but gives the exact same results as the current one. The use of `posixpath.relpath` pulled in several path-specific transformations that are never needed here.

Efficiency is important because calls to `normalize_url` (e.g.) on a site with ~300 pages currently take up ~10% of the total run time due to the sheer number of them. The number of calls is at least the number of pages squared.
2021-07-07 18:51:40 +02:00
Jerzy Kozera
a012d2e65d Fix reversed breadcrumbs in rtd theme (#2179) 2021-07-07 18:38:22 +02:00
Oleh Prypin
f8b9e96718 Fix gh_deploy with config-file in the current directory (#2481)
If the config file is specified as relative and is in the current directory, the `dirname` transform came out empty, which `subprocess` doesn't like as `cwd`.
2021-07-05 21:29:45 +02:00
Oleh Prypin
c1f6221b47 Fix serving files/paths with Unicode characters (#2464) 2021-07-05 21:28:08 +02:00
Waylan Limberg
bd167cf3f6 Bump version to 1.2.1 1.2.1 2021-06-09 13:20:07 -04:00
Christian Oliff
55e1cdf6ea fix example typo in release notes 2021-06-09 08:57:25 -04:00
Waylan Limberg
d3f8b242d3 babel is required for deployment 2021-06-07 11:26:06 -04:00
Waylan Limberg
2688a6d88d Ensure gh-deploy always pushes
This was a regression in behavior. I had missed that `push` and `force`
are two separate parameters of `ghp_import.ghp_import` in #2257.
2021-06-07 11:25:20 -04:00
Waylan Limberg
cd43e9a243 Bump version to 1.2 1.2 2021-06-07 09:44:23 -04:00
Oleh Prypin
b221df94fa Restore the ability to watch files through relative symlinks
Restore the ability to watch files through relative symlinks
(i.e. symlinks that have a non-absolute path as the target)

This was not fully fixed in #2427.

Switch from os.path.realpath to pathlib.Path.resolve
2021-06-04 10:42:38 -04:00
Waylan Limberg
769a926691 Correct documentation of on_pre_template event.
The behavior of this event has never changed. The documentation was simply
incorrect. Fixes #2308.
2021-06-02 13:01:21 -04:00
Waylan Limberg
80feaf03a4 Deprecate google_analytics config option.
A new replacement option (theme.analytics.gtag) was added to the built-in themes. Multiple different services could be offered under theme.analytics. At this time only support for gtag exists, but more could be added in the future.

Fixes #2252.
2021-06-02 11:02:01 -04:00
Waylan Limberg
57b5ccd7d6 Add support for Configuration Inheritance
* Support dict only markdown_extensions config
* Support dict only plugin config
* Remove explicit conversion to Unicode as PY2 is no longer supported.
* Refactor yaml_load so that is can recursively call itself.

Fixes #2218.
2021-06-01 14:50:00 -04:00
Oleh Prypin
70f2cca09d Restore the functionality of watching files through symlinks
Watchdog doesn't support it directly but it happened to work everywhere except Windows

This is achieved by walking through the target directory, finding any symlinks in it, and watching their target too (+recursive walking of those too).

Important note: only symlinks that exist during startup will be taken into account, new ones aren't added.

Fixes #2425
Closes #2426
2021-06-01 14:24:43 -04:00
Ultrabug
8f5be54d85 utils: fix get_themes WARNING logs due to possible entry point
duplicates returned by importlib_metadata during tests

instead of using lists, we use and compare on sets

thanks to @oprypin for the heads up
2021-06-01 14:21:50 -04:00
Oleh Prypin
d9b957e771 Offset the local site root to the path of the site_url 2021-05-25 13:11:41 -04:00
Tom Klingenberg
044d8dd5e6 No exception if directory already removed
When `mkdocs serve` is shutting down, it cleans up after itself removing
the temporary directory created earlier.

Previously the condition whether the directory is to be removed was
unchecked and prone to a file system race condition (shared resource).

Given the directory is absent on the file-system while shutting down,
`mkdocs serve` threw an exception and exited in failure.

Change is to override the cause of the exception by preventing the
attempt to remove a directory that is already gone.

Closes #2420.
2021-05-25 11:58:53 -04:00
Oleh Prypin
a444c43474 Reimplement livereload
This discards the dependency on 'livereload' and 'tornado'. This implementation is based on stdlib http.server and is much smaller, while not being a downgrade in any way.

This fixes #2061: multiple file changes no longer cause the site to repeatedly rebuild.
It also makes reloads much more responsive; they're "instant" rather than being on a 1-second polling interval or such.

Each HTML page gets JavaScript injected into it (like before) but now, instead of connecting to WebSocket, it requests a long-polling endpoint, which blocks until a newer version ("epoch") of the site is available - then the page knows to reload itself. After a minute without events, the endpoint will just return the unchanged epoch (to avoid timeouts), then the page requests the same endpoint again. The "downtime" in between requests is not a problem because these are not events that need to be received in real time; the endpoint can instantly report that the latest version is newer than the one the page identified itself as.

The reason to replace WebSocket isn't that it's bad or something, just that stdlib doesn't have it. But long-polling works completely fine here too.
2021-05-25 10:16:31 -04:00
Waylan Limberg
d54419d54b Document deploying to local files 2021-05-18 13:13:05 -04:00
Waylan Limberg
5fc92b96e7 Documentation improvements
Clean up and improve the documentation following some recent changes.
Specificaly, ensure we consistantly document *two* required settings.
2021-05-18 13:13:05 -04:00
Waylan Limberg
aae31c88c9 Fix typo 2021-05-17 15:34:59 -04:00
Waylan Limberg
b89ec5792e Ensure site_url and use_directory_urls do not conflict.
The site_url config option is now required. If it is set to an empty
string, then use_directory_urls will be forced to false. Each will
issue a warning if not properly set. In a future release we may
raise an error instead.

Fixes #2189.
2021-05-17 09:44:28 -04:00
Waylan Limberg
e2a3480735 Remove hard dependency on lunr.py (#2402)
Begin deprecation of 'python' option of 'plugins.search.prebuild_index'.
2021-05-13 15:20:35 -04:00
Oleh Prypin
23e205153f Replace use of deprecated alias jinja2.Markup
- use `markupsafe.Markup` directly instead.

Note: the choice of version is to match https://github.com/pallets/jinja/blob/2.10.1/setup.py
2021-05-13 10:38:33 -04:00
Álvaro Mondéjar
775d506c63 Update IpAddress tests for Python3.9.5 2021-05-08 09:40:37 -04:00
Álvaro Mondéjar
a8ec4b64a3 Add 'es' themes translations
Document that, when a new translation is added for a theme, the documentation about the theme must be updated.
2021-05-07 09:57:19 -04:00
Oleh Prypin
59f7c0f4d2 Use f-strings instead of formatting 2021-05-07 09:51:53 -04:00
Ultrabug
e1b77ab66e Support theme localization
A framework for translating themes as been added, which includes:

1. Use of Jinja's `i18n` plugin for translating phrases in templates (not page content).
2. A French translation of the built-in themes (contributions in other languages are welcome).
3. A new `theme.locale` option to define the locale/language of the site.
4. The search plugin uses the value of `theme.locale` as its default 'lang'.
5. Third party themes may chose to use the framework (use is optional).
6. A documented workflow for translating MkDocs built-in themes.
7. Custom tooling for use by translators and theme devs.

The dependencies are not installed by default and are not needed to use MkDocs without translations. However, for anyone who wants to make use of the features, `pip install mkdocs[i18n]` will install all necessary dependencies.

Relates to #211.
2021-05-06 14:30:21 -04:00
Oleh Prypin
34a425e5a5 Use paths already in context from create_media_urls
No need to recreate them from the config again.
2021-05-02 20:13:22 -04:00
Álvaro Mondéjar
d0202a512e Include hidden pages in sitemap
Closes #2177

* Instead of using nav items for sitemap entries rendering, `[file.page for file in pages]` is used.
* Rendered sitemap.xml content is properly formatted using 4 spaces for indentation.
2021-04-25 15:55:37 -04:00
Oleh Prypin
be69601e0c Fix wrapping of multiline strings for ColorFormatter 2021-04-25 15:51:48 -04:00
Waylan Limberg
cb85d48851 Improve CLI textwrapping
* Account for user's actual terminal width
* Skip wrapping if not in a terminal
* Preserve whitespace
* Avoid breaking long words and on hyphens
2021-04-20 10:24:30 -04:00
Pawel Borkar
749d1ff79a Update the LICENSE and the README 2021-04-19 14:44:21 -04:00