135 Commits

Author SHA1 Message Date
Jasper J.F. van den Bosch
26212481ad Documentation... add missing trailing slash to table for use_directory_urls (#4042) 2025-10-20 14:16:09 +01:00
Matthew Strawbridge
7e4892ab2d Fix documentation of draft_docs and exclude_docs, add tests (#3859) 2024-11-06 16:31:45 +01:00
gesslar
200f6f98b0 Update configuration.md
Very minor grammar issue.
2024-08-27 22:07:29 -04:00
Ronny Zulaikha
f12315d78f Updated description of use_directory_urls (#3798)
Co-authored-by: Timothée Mazzucotelli <dev@pawamoy.fr>
2024-08-07 12:53:18 +02:00
Oleh Prypin
a793da267b Add the hook file's directory to sys.path (#3568)
Also clean sys.path after the hook is done, for some semblance of isolation
2024-03-16 16:05:17 +01:00
Oleh Prypin
369dcc0aa1 Apply new markdownlint rule table-pipe-style 2024-01-29 21:56:36 +01:00
Oleh Prypin
8833edcc94 Fix some broken links 2023-12-15 21:56:25 +01:00
Oleh Prypin
7245a636cc Also make 'relative_to_docs' work for nav validation 2023-12-11 23:51:56 +01:00
Oleh Prypin
a42ab62311 Validation of absolute links relative to docs root 2023-12-11 23:51:50 +01:00
Oleh Prypin
9e443d2120 For validation, pick up anchors also from raw HTML (#3505) 2023-12-11 23:49:10 +01:00
Allison Thackston
3e809b6bd6 Add additional 'drafts' level to inclusion (#3476)
Co-authored-by: Oleh Prypin <oleh@pryp.in>
2023-12-11 22:36: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
7c3c3981b8 Docs: fix or drop broken anchor links 2023-11-11 14:28:14 +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
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
89c7aa69ac Merge pull request #3283 from mkdocs/warnc
Expand link validation, add configs for it
2023-07-09 16:04:37 +02:00
Oleh Prypin
8353493606 Use YAML indentation width of 2 spaces (#3287) 2023-07-09 15:59:51 +02:00
Oleh Prypin
aef55990b9 Propagate 1st-level validation keys to the 2nd-level sub-dicts 2023-07-02 18:50:23 +02:00
Oleh Prypin
4150d2b8ce Configurable diagnostics around broken links to docs
Expand the situations where logs about broken links are produced, make the logging levels fully configurable
2023-07-02 18:50:23 +02:00
Oleh Prypin
99a9a90553 Document the !relative tag 2023-06-25 23:11:55 +02:00
Oleh Prypin
ce826e94cc Merge pull request #3268 from mkdocs/conft
More precise types; support stdin as the `--config-file`
2023-06-19 22:22:10 +02:00
Oleh Prypin
9394d4b168 Merge remote-tracking branch 'origin/master' into mjs 2023-06-18 19:18:22 +02:00
Oleh Prypin
d5bb15fa10 Properly support config_file_path being None
* Prevent error when the config file is a stream, to support `-` as the config.
* Fix type annotations and edge cases when `config_file_path` is None
* Properly prevent users setting `config_file_path` in mkdocs.yml - this was not intended.
2023-06-18 17:55:41 +02:00
Oleh Prypin
9d56fa21d9 Merge remote-tracking branch 'origin/master' into ignore 2023-06-09 20:18:54 +02:00
Oleh Prypin
4f98a94f14 Fix typo in extra_javascript doc 2023-06-08 10:33:48 +02:00
Oleh Prypin
3363c615de Update docs - "best-of-mkdocs" became "catalog" 2023-06-07 00:39:01 +02:00
Oleh Prypin
32d8c3a986 Expand config.extra_javascript to support type, async, defer
The top-level template object `extra_javascript` gets soft-deprecated because it still reports only a list of plain strings.

Themes need to take action and pick up the new config keys from `config.extra_javascript` instead.
2023-06-04 00:37:41 +02:00
Oleh Prypin
930ae26a55 New flag mkdocs serve --clean - simulate a pure mkdocs build and then serve
Also rename `--dirtyreload` flag to `--dirty` (keep the old name working)
2023-05-29 01:04:29 +02:00
Oleh Prypin
f37ce51da1 Serve excluded files in mkdocs serve + new not_in_nav config
* Docs that match any of the `not_in_nav` patterns will not produce warnings about never being included into the nav.

* Files that are excluded by `exclude_docs` will now be preserved in the `Files` collection and will even be rendered but only in `mkdocs serve` mode - such files will have a `DRAFT` notice prepended to the content.
2023-05-29 01:04:29 +02:00
Oleh Prypin
67e0e4e052 New exclude_docs config: gitignore-like patterns of files to exclude
These files will not be picked up into the `Files` collection and as such, also the final built site.

Also adds the ability to *un*-ignore the files that MkDocs forcibly ignores.
2023-05-28 23:10:25 +02:00
Oleh Prypin
4ac1484de3 Link to Best-of-MkDocs instead of Plugins wiki in docs (#3207)
https://github.com/mkdocs/best-of-mkdocs
2023-05-02 22:42:16 +02:00
Hélène Martin
0c1e9917a5 Align edit_url text and example (#3124) 2023-04-21 19:16:47 +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
2a8ed44d9e Hooks feature: run plugin events from local Python files (#2978) 2022-09-19 22:18:38 +02:00
Oleh Prypin
4d4ef4c8f7 Add docs and tests for edit_uri_template option 2022-09-10 13:41:55 +02:00
Oleh Prypin
cd1135ee3e Fix remaining markdownlint issues, partly by replacing definition lists (#2914) 2022-08-07 14:46:10 +02:00
Oleh Prypin
22af92c874 Migrate docs from "admonition" to "callouts" extension (#2684)
The result is exactly equivalent, just different syntax -- one that doesn't look weird in vanilla Markdown parsers such as on GitHub.
The output HTML before/after is equivalent , other than adding `<p class="admonition-title">Block</p>` in two cases, which I hid with CSS.

This also contributes to fixing the currently-present markdownlint MD053 violations, as it can't scan inside admonitions.

Add 'markdown-callouts' to dependencies and bump Markdown dep.
2022-08-06 17:35:36 +02:00
Simon Li
03b48936e3 Docs: site_url is optional (#2863) 2022-07-18 23:49:23 +02:00
Fullchee Zhang
c32fbe3376 Fix typo in configuration.md (#2844) 2022-05-18 00:20:24 +02:00
steven-terrana
82fcf3115a Support custom directories to watch when running mkdocs serve (#2642)
* adds a `watch` property to the `mkdocs.yaml` schema. Accepts a list of directories to watch.
* adds a `-w`/`--watch` command line option to `mkdocs serve` that can be passed multiple times
* options from `mkdocs.yaml` and CLI flags are combined
* the livereload server will also print the directories that it watches
* docs updated

Co-authored-by: Oleh Prypin <oleh@pryp.in>
2021-11-07 10:29:58 +01:00
Álvaro Mondéjar
b4fd3411f2 Fix mistake in docs about nav configuration (#2636) 2021-10-26 20:40:04 +02:00
Álvaro Mondéjar
8345850060 Add hint about -f/--config-file in configuration documentation (#2616) 2021-10-12 22:10:48 +02:00
Álvaro Mondéjar
4d1d1c1ba5 Fix various typos using codespell (#2549) 2021-08-20 17:06:01 +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
Oleh Prypin
b12804d97e Fix some spelling typos (#2489) 2021-07-13 19:07:59 +02: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
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
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