Commit Graph

1800 Commits

Author SHA1 Message Date
Oleh Prypin
9ada9bf969 Also tighten warnings of plugin configs 2022-10-08 14:56:20 +02:00
Oleh Prypin
6b4d20e1eb Refactor plugin_cache usage to avoid nested exception 2022-10-08 14:49:04 +02:00
Oleh Prypin
ca8a3c8d67 Tighten warnings and type annotations in config_options 2022-10-08 14:49:04 +02:00
Oleh Prypin
76709ab540 Expand plugin testing 2022-10-08 14:49:04 +02:00
Oleh Prypin
7a72282f8a Refactor Theme config option to use mainly run_validation 2022-10-08 14:48:46 +02:00
Oleh Prypin
b2083d07f5 Add CLI reference page, auto-generated from Click (#2996) 2022-10-08 11:17:05 +02:00
Oleh Prypin
aa10190a55 Migrate from Tox to Hatch as test runner (#2991) 2022-10-07 23:18:05 +02:00
Oleh Prypin
65c24c21f0 Integrate Babel build steps as a Hatch hook (#2992) 2022-10-07 18:07:35 +02:00
Oleh Prypin
30cdac47a9 Switch to pyproject.toml and Hatch build (#2988) 2022-10-07 00:42:48 +02:00
Oleh Prypin
12ee265cc1 Remove pybabel setuptools integration (#2990) 2022-10-03 19:30:02 +02:00
Oleh Prypin
f2c648b35f Fix tests that wrote something into the source directory 2022-10-03 01:22:25 +02:00
Oleh Prypin
418d23a4da Actually depend on 'colorama' on Windows (#2987)
This was missed in #2606
2022-10-02 20:14:06 +02:00
Oleh Prypin
1a43c4a111 Remove unused FontAwesome.otf 2022-10-02 15:03:12 +02:00
Oleh Prypin
4dd64a6950 Mention event priority values also in release notes 2022-09-27 20:00:35 +02:00
Oleh Prypin
927ee2684b Release 1.4.0 (#2986) 1.4.0 2022-09-27 19:26:54 +02:00
Oleh Prypin
5cce5012b4 Merge pull request #2962 from mkdocs/meta
Rework ConfigOption schemas as class-based
2022-09-26 14:25:18 +02:00
Oleh Prypin
5015fa72af Add examples of class-based schema with ListOfItems 2022-09-26 11:35:24 +02:00
Oleh Prypin
cc627f7ba3 Prevent wrapping into Optional when the option has a default 2022-09-26 11:35:24 +02:00
Oleh Prypin
aeffe61499 Change config_options.URL's default from '' to None 2022-09-26 11:35:24 +02:00
Oleh Prypin
51569476c0 Add a test for subclassing a config schema 2022-09-25 20:03:54 +02:00
Oleh Prypin
ff8552a57a Add tests for new class-based configs
The old-style tests are intentionally kept at config_options_legacy_tests.py
2022-09-25 20:03:54 +02:00
Oleh Prypin
6d8c4d1c7f Preserve a copy of config_options_tests before reworking it 2022-09-25 20:03:20 +02:00
Oleh Prypin
452f56c61f Move config_options_tests.py before reworking it 2022-09-25 20:02:57 +02:00
Oleh Prypin
cf9d23757e Change ListOfItems' "default default" from [] to None 2022-09-25 19:19:10 +02:00
Oleh Prypin
4470c75ee9 Support passing Config subclasses to SubConfig
They are validated by default
2022-09-25 19:19:09 +02:00
Oleh Prypin
ac0efce437 Add Optional config but make fields in class-based config required 2022-09-25 19:19:09 +02:00
Oleh Prypin
a4c1bb14dc Add documentation for type-checked configs 2022-09-25 19:19:09 +02:00
Oleh Prypin
e160c47962 Eliminate the need to write config_class = FooConfig
when subclassing BasePlugin[FooConfig]
2022-09-25 19:19:09 +02:00
Oleh Prypin
1ab0a9f84b Use attribute-based access from MkDocsConfig 2022-09-25 19:19:09 +02:00
Oleh Prypin
46afe3ffef Annotate the type MkDocsConfig 2022-09-25 19:19:09 +02:00
Oleh Prypin
eb3264c634 Add type annotations to ConfigOptions, enabling actual type safety 2022-09-25 19:19:09 +02:00
Oleh Prypin
73e8fef506 Rework ConfigOption schemas as class-based
This is NOT a breaking change, the old style keeps working.

Now developers can make a subclass of Config, declare the schema of the config as fields of the class, and instances of this class will hold the processed config.

This better represents the relationship between what a config definition and a config instance is, now you think of configs definitions as classes and parsed configs as instances.

We also can write these fields as descriptors and enable safe attribute-based access. Static analysis will be able to see when a missing fields is accessed. And in followup changes I plan to add type annotations which will make even type checking fully sound.
2022-09-25 19:19:07 +02:00
Oleh Prypin
4a56b4a72b Merge pull request #2983 from mkdocs/meta1
Refactor in preparation for ConfigOption schemas rework
2022-09-25 19:16:36 +02:00
Oleh Prypin
9c48c3317f Revert dropping support for backslashes in media URIs (#2984)
Only show a warning for now.
2022-09-25 14:53:40 +02:00
Oleh Prypin
2263c50e80 Soft-deprecate ConfigItems instead of expanding it
This undoes the addition of the `validate` parameter from ee844242d1.
It is OK to do because this was not released yet.
2022-09-24 22:37:29 +02:00
Oleh Prypin
dba48e1564 Refactor config_option_tests to be more consistent 2022-09-24 22:37:25 +02:00
Oleh Prypin
f1da904a7f Refactor: use config_options module through a short alias 'c' 2022-09-22 23:23:23 +02:00
Oleh Prypin
dce025e544 Remove duplicated style due to a merge mistake 2022-09-19 22:46:24 +02:00
Oleh Prypin
bc5ca89b16 Merge pull request #2982 from mkdocs/styl2
Docs: update Markdown style
2022-09-19 22:25:39 +02:00
Oleh Prypin
81d6ebf59d Replace instances of ```no-highlight 2022-09-19 22:22:33 +02:00
Oleh Prypin
6123328cbe Enforce fenced codeblocks in our docs 2022-09-19 22:22:33 +02:00
Oleh Prypin
8dfef829b8 Enable <details> admonitions and nested codeblocks 2022-09-19 22:22:12 +02:00
Oleh Prypin
b33fb2ac67 Update admonition styles in MkDocs theme: (#2981)
* Apply admonition styles also to <details> tags
* Increase contrast of default admonitions
* Add some admonition styles (only for use on MkDocs' site for now)
2022-09-19 22:19:04 +02:00
Oleh Prypin
2a8ed44d9e Hooks feature: run plugin events from local Python files (#2978) 2022-09-19 22:18:38 +02:00
Oleh Prypin
aa4e669c33 Add Ukrainian translations (#2980) 2022-09-19 21:52:05 +02:00
Alexander Krasnikov
b11bed87ab Add Russian localization (#2976)
Co-authored-by: Oleh Prypin <oleh@pryp.in>
2022-09-19 09:06:03 +02:00
Oleh Prypin
cf8a07475f Deduplicate the nav specification with literate-nav 2022-09-18 18:47:54 +02:00
Oleh Prypin
00a71ba0be Move more documentation from Markdown into docstrings 2022-09-18 16:39:20 +02:00
Oleh Prypin
5685e93406 Relax some type annotations for Config, accept a dict 2022-09-18 16:39:20 +02:00
Álvaro Mondéjar
0ecb52f835 Allow to unwatch files with LiveReloadServer (#2777)
Co-authored-by: Oleh Prypin <oleh@pryp.in>
2022-09-18 14:32:21 +02:00