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
Oleh Prypin
730da08158
Make compile_catalog actually fail on error, to catch it in CI ( #2979 )
2022-09-17 18:40:18 +02:00
Oleh Prypin
8315ece4f6
Consistently separate followup kwargs in plugin events
2022-09-14 18:59:26 +02:00
Oleh Prypin
8c3ea5fd12
Merge pull request #2972 from mkdocs/onshut
...
Add plugin events that persist across builds in `mkdocs serve`
2022-09-14 18:55:08 +02:00
Oleh Prypin
f0ae255455
Improve warning stack trace detection
...
Handle the cases where:
* Several useless "importlib_bootstrap" frames are inserted in between.
* The warning is about syntax, so the file location wouldn't even show up in the stack trace.
2022-09-14 18:46:33 +02:00
Oleh Prypin
62d8a6f44d
Let plugins choose the priority order of their events ( #2973 )
...
Add a decorator that sets a priority value for plugins' events. Events with higher priority are called first. Events without a chosen priority get a default of 0. Events that have the same priority are ordered as they appear in the config.
2022-09-14 17:33:06 +02:00
Oleh Prypin
283c36250d
Merge pull request #2927 from mkdocs/edit-uri
...
Add `edit_uri_template` config
2022-09-12 22:59:34 +02:00
Oleh Prypin
e44134797b
on_startup: also pass a boolean dirty to detect --dirtyreload
2022-09-11 23:06:34 +02:00
Oleh Prypin
a56ac6e051
Add plugin events that persist across builds in mkdocs serve
...
"One-time events" `on_startup(command)`, `on_shutdown`.
Their presence also shows that a plugin *wants* to persist across builds. Otherwise they will be re-created, to not change any existing behavior.
2022-09-11 23:06:34 +02:00
Oleh Prypin
4d4ef4c8f7
Add docs and tests for edit_uri_template option
2022-09-10 13:41:55 +02:00
Oleh Prypin
4fcbdd3d3c
Refactor test_page_edit_url
2022-09-10 00:12:45 +02:00
Oleh Prypin
ad43f1b8b7
Add edit_uri_template config
2022-09-09 22:19:28 +02:00
Oleh Prypin
287a11dc60
Refactor relationship between repo_url, repo_name, edit_uri
...
And deprecate RepoURL
2022-09-09 22:19:28 +02:00
Oleh Prypin
9ac7322b00
Fix get_schema to preserve the definition order
...
although it will no longer pick up fields of superclasses.
2022-09-09 22:18:55 +02:00
Oleh Prypin
5b853510ee
Restore listening on 'localhost' host - fix for previous commit
2022-09-07 18:40:43 +02:00
Oleh Prypin
53e1ab871a
Support listening on an IPv6 address
...
This got broken with version 1.2
Fixes #2951
2022-09-07 18:30:07 +02:00
Oleh Prypin
df3739d519
Add a lot more type annotations, fix new type warnings ( #2970 )
...
(including some behavior changes, assumed to be no-op)
This is based on auto-generated annotations from "monkeytype".
2022-09-07 18:04:39 +02:00
Oleh Prypin
0f839c0679
Speed up some tests by caching the initial loading
2022-09-06 01:37:32 +02:00
Oleh Prypin
2a5db31ea0
Resolve import issues when running individual test files
2022-09-06 00:47:27 +02:00
Oleh Prypin
bd3bdecafd
Merge pull request #2963 from mkdocs/cfgtest
...
Refactor config_options_tests to use less implementation details
2022-09-06 00:24:56 +02:00
Oleh Prypin
3fd48806aa
Refactor config_options_tests to use less implementation details
...
Prevent missed warnings, test more error messages.
And minor fixes to error messages themselves.
2022-09-05 02:05:14 +02:00
Oleh Prypin
5f101e8d48
Fix and simplify config_options.Deprecated moved_to
2022-09-05 00:49:20 +02:00
Oleh Prypin
13b9c0dbd1
Refactor tests for ConfigOption errors
2022-09-04 17:35:24 +02:00
Oleh Prypin
49a80bd583
Remove empty line at the beginning of def body
2022-09-03 13:40:01 +02:00
Oleh Prypin
b53e167ad1
Refactor test setup for temporary directories
2022-09-03 13:19:56 +02:00
Oleh Prypin
88df80e1f4
Test logs more, disallow stray warnings
2022-09-03 10:08:39 +02:00
Oleh Prypin
957b874e60
Let plugins write directly into site_dir
2022-09-02 23:19:26 +02:00
Oleh Prypin
52b8e80b9d
Use monotonic clock to measure time
...
Otherwise it can jump around with system clock updates
2022-09-02 23:07:29 +02:00
Oleh Prypin
3c917bbf18
Merge pull request #2938 from mkdocs/reconfig
2022-09-02 20:49:34 +02:00
Oleh Prypin
140fc78ddb
Add basic type annotations to ConfigOption constructors
2022-09-02 20:47:48 +02:00
Oleh Prypin
2c07e443c6
Extract a PlainConfigSchema alias
2022-09-02 20:47:48 +02:00