2016 Commits

Author SHA1 Message Date
Oleh Prypin
d110f03f48 CI: Bump node-version 2023-12-09 18:25:38 +01:00
Oleh Prypin
1910381516 Merge pull request #3463 from mkdocs/anch
Implement validation of anchors in links to other pages
2023-12-09 18:08:16 +01:00
Oleh Prypin
ebaefd7451 Warn when multiple 'on_page_read_source' handlers are added (#3503) 2023-12-08 21:42:42 +01:00
Oleh Prypin
ccf011db79 Make sitemap.xml.gz slightly more reproducible (#3460)
Use the latest page update time instead of the current time

Now the date of the gzip file will change only once per day, based on the pages' update date. The sitemap.xml itself also changes once per day already.
2023-12-08 21:39:14 +01:00
Oleh Prypin
64cab0d77f Merge pull request #3502 from mkdocs/hatchdoc
Use hatch-mkdocs and hatch-pip-compile for docs deps
2023-12-05 21:48:13 +01:00
Oleh Prypin
2929628a8b Fix wrong @tempdir invocations in tests 2023-12-03 23:25:01 +01:00
Oleh Prypin
df2dffd8a6 New flag serve --open to open the site in a browser (#3500)
After the first build is finished, the default webbrowser will open the home page of the site.
2023-12-03 22:00:13 +01:00
Oleh Prypin
8035d78dad Refactor serve URL handling, pass only the URL to build (#3501)
Co-authored-by: Philipp Temminghoff <philipptemminghoff@googlemail.com>
2023-12-03 21:59:46 +01:00
Oleh Prypin
0d25830a20 Add a CI job checking that the docs site builds 2023-12-03 13:11:33 +01:00
Oleh Prypin
4ad0dd16b2 Use hatch-mkdocs and hatch-pip-compile for docs deps 2023-12-03 13:11:33 +01:00
Oleh Prypin
646987da45 Merge pull request #3465 from mkdocs/secu
Stop executing YAML tags for mkdocs_theme.yml, warn about third-party projects
2023-11-21 21:46:31 +01:00
Oleh Prypin
eaf4e4f4c3 Merge pull request #3464 from mkdocs/rtnav
Fix readthedocs theme expanding all top level ToC entries
2023-11-21 21:10:44 +01:00
Oleh Prypin
47e41a9a0e Still use the fast version of SafeLoader 2023-11-21 21:08:28 +01:00
Oleh Prypin
35fb2c7203 Move code to external mkdocs-get-deps dependency (#3477)
The "get-deps" command will still be provided inside MkDocs like before (and is not deprecated at all) but is now implemented in a separate repository and can be used directly from there as well.

This separation of code was done because obtaining just the "get-deps" part with very few dependencies can be useful: one can run it in a main environment but then install actual MkDocs with dependencies in a virtual environment.
2023-11-21 21:03:41 +01:00
Oleh Prypin
8aafea1742 Fix overzealous validation of !relative tag (#3466)
If a Markdown extension immediately resolves the path inside its initialization (rather than just storing it for later as I was hoping) then it was failing the initial validation run that MkDocs does without populating an actual page yet.
2023-11-14 18:35:30 +01:00
Oleh Prypin
c3c980582f Cache the result of the function get_themes() 2023-11-11 16:50:49 +01:00
Oleh Prypin
9ff9bb10bf Docs: warn about installing third-party plugins 2023-11-11 16:50:48 +01:00
Oleh Prypin
9e67e466f8 Stop allowing arbitrary YAML tags for mkdocs_theme.yml 2023-11-11 16:50:48 +01:00
Oleh Prypin
da35dcad0c Support mkdocs-section-index plugin in readthedocs theme
-Handle the case when something is both a page and a section
2023-11-11 16:18:12 +01:00
Oleh Prypin
575a19a5f4 Fix readthedocs theme expanding all top level ToC entries 2023-11-11 16:17:36 +01:00
Oleh Prypin
04cca3bff7 Implement validation of anchors in links to other pages
Example message:

    WARNING -  Doc file 'dev-guide/themes.md' contains a link '../user-guide/configuration.md#google_analytics', but the doc 'user-guide/configuration.md' does not contain an anchor '#google>

It is not enabled by default. To enable, use config `validation: {anchors: warn}`

The implementation only detects Markdown anchors, not raw HTML anchors. As such it may have false positives.

```markdown
<a id="undetectable-anchor"></a>

## Detectable anchor
```

There are plans to improve that in the future.

But that's just about user-authored HTML.
As for HTML that Markdown extensions insert: it will also work correctly if they insert the HTML as etree elements and will never work if they insert it via `htmlStash`. Basically the same rules as for what `toc_tokens` is able to detect.
2023-11-11 16:07:25 +01:00
Oleh Prypin
3f7c5ca129 Update docs about logging in plugins 2023-11-11 16:07:25 +01:00
Oleh Prypin
4ce945e72c Set logging levels on the logger rather than just the stream
Otherwise currently `log.getEffectiveLevel()` always reports `1` and doesn't allow optimizing away debug logging statemets.
2023-11-11 15:55:03 +01:00
Oleh Prypin
7c3c3981b8 Docs: fix or drop broken anchor links 2023-11-11 14:28:14 +01:00
Oleh Prypin
96bfc70210 Make File hashable, without __eq__ 2023-11-11 14:28:04 +01:00
Oleh Prypin
dc45916aa1 Allow adding event handlers at multiple priorities (#3448)
-within one plugin.
2023-11-08 18:33:38 +01:00
Oleh Prypin
0a4f3240d1 Use projects' own type annotations, stubs no longer needed 2023-11-02 00:02:29 +01:00
Vedran Miletić
0bf4963090 Quote pip arguments containing square brackets (#3456)
This is strictly necessary when using non-bash shells (e.g. tcsh).
2023-11-01 17:20:14 +01:00
Oleh Prypin
9455b079d8 Stop suppressing OSError indiscriminately during build (#3445)
This was aimed at user-facing "file not found" errors from "serve" but it can catch errors from plugins as well, and it only makes the errors very confusing.
2023-10-31 09:49:12 +01:00
Oleh Prypin
8909ab3f6d Reduce logs for invalid links if referring page is excluded (#3449)
* If source page and destination page is excluded, cap log level to DEBUG
* If source page is excluded, cap log level to INFO

Co-authored-by: Chris Mayfield <mayfiecs@jmu.edu>
2023-10-30 02:04:50 +01:00
Oleh Prypin
7ab01c24ff Add an enabled setting for all plugins (#3395)
For every plugin, the user can set `enabled: false` (or something based on an environment variable) and it will not kick in at all.

If the plugin has its own `enabled` config, there's no change for it in that case.
2023-10-30 01:58:27 +01:00
Oleh Prypin
f3d5c8dc8d Refactor File tests 2023-10-30 00:56:24 +01:00
Oleh Prypin
3a69c9a6dd Merge pull request #3443 from mkdocs/innav
Apply planned changes to `File.page` and `not_in_nav`
2023-10-30 00:56:09 +01:00
Oleh Prypin
ae93314b9a In verbose log, report each plugin's events individually (#3444) 2023-10-29 18:40:36 +01:00
Oleh Prypin
994ffff114 Clean up unused args in tests 2023-10-29 12:13:56 +01:00
Oleh Prypin
f31caca339 mypy: Stop ignoring missing imports 2023-10-29 10:49:15 +01:00
Oleh Prypin
d107e6d32c When nav config is not specified, apply file inclusion
to decide whether a file in included when generating the implicit nav.

Fixes #3336
2023-10-28 17:40:15 +02:00
Oleh Prypin
a94a014e01 Error when setting File.page to a type other than Page
As per the prior plan https://github.com/mkdocs/mkdocs/pull/3381#issuecomment-1712750515
2023-10-28 17:38:42 +02:00
Oleh Prypin
b5250bf9e2 Stop config validation after the first error (#3437)
If one config option completely fails validation, that means its value remains "raw" from YAML, which can cause unpredictable errors when validating other options that might look at the value. Instead just decide one error is enough.
2023-10-25 19:41:00 +02:00
sumebrius
49d02e48ed Add fallback git link for non-provider repos (#3435) 2023-10-25 19:40:42 +02:00
Oleh Prypin
3e0949a332 Merge pull request #3430 from mkdocs/ruffdocs
Apply more rules from ruff, esp. for docstrings
2023-10-20 15:31:30 +02:00
Oleh Prypin
3c9d0765ea Merge pull request #3429 from mkdocs/py37
Drop Python 3.7, officially support Python 3.12
2023-10-20 15:30:40 +02:00
Oleh Prypin
125f36f943 Enable more ruff rules 2023-10-16 22:42:10 +02:00
Oleh Prypin
4710d73999 Apply rules to docstrings 2023-10-16 22:41:10 +02:00
Oleh Prypin
0d8d1f2b4d Use features new to Python 3.8, apply positional-only args
(the latter constitutes a breaking change for MkDocs, but nobody should be relying on these as named args)
2023-10-16 22:39:14 +02:00
Oleh Prypin
e2a9576b24 Drop Python 3.7, officially support Python 3.12 2023-10-16 22:39:14 +02:00
Oleh Prypin
828f4685f2 Fix unittest invocation on Windows, don't apply coverage by default
-Tests actually weren't being run on Windows!
2023-10-16 22:32:28 +02:00
Oleh Prypin
cc76672d55 Workaround: babel depends on setuptools without declaring it
https://github.com/python-babel/babel/issues/1031
2023-10-16 22:32:28 +02:00
Oleh Prypin
ad73366e52 Fix tests on Windows 2023-10-16 22:32:28 +02:00
Oleh Prypin
b3992222b1 Move forward with some deprecations (#3425) 2023-10-16 22:32:08 +02:00