Add additional 'drafts' level to inclusion (#3476)

Co-authored-by: Oleh Prypin <oleh@pryp.in>
This commit is contained in:
Allison Thackston
2023-12-11 13:36:36 -08:00
committed by GitHub
parent d110f03f48
commit 3e809b6bd6
6 changed files with 52 additions and 18 deletions

View File

@@ -157,7 +157,6 @@ The `exclude_docs` config follows the [.gitignore pattern format](https://git-sc
```yaml
exclude_docs: |
*.py # Excludes e.g. docs/hooks/foo.py
/drafts # Excludes e.g. docs/drafts/hello.md
/requirements.txt # Excludes docs/requirements.txt
```
@@ -169,6 +168,10 @@ See [**documentation**](../user-guide/configuration.md#exclude_docs). Context: #
#### Drafts
> DANGER: **Dropped from version 1.6:**
>
> The `exclude_docs` config no longer applies the "drafts" functionality for `mkdocs serve`. This was renamed to [`draft_docs`](../user-guide/configuration.md#draft_docs).
The `exclude_docs` config has another behavior: all excluded Markdown pages will still be previewable in `mkdocs serve` only, just with a "DRAFT" marker on top. Then they will of course be excluded from `mkdocs build` or `gh-deploy`.
If you don't want `mkdocs serve` to have any special behaviors and instead want it to perform completely normal builds, use the new flag `mkdocs serve --clean`.

View File

@@ -295,6 +295,10 @@ sub-directories. Index files will always be listed first within a sub-section.
NEW: **New in version 1.5.**
> DANGER: **Changed in version 1.6:**
>
> This config no longer applies the "drafts" functionality for `mkdocs serve`. If you have draft documents that you want available in "serve" and not "build", replace `exclude_docs` with the new [`draft_docs`](#draft_docs) config option.
This config defines patterns of files (under [`docs_dir`](#docs_dir)) to not be picked up into the built site.
Example:
@@ -302,7 +306,6 @@ Example:
```yaml
exclude_docs: |
api-config.json # A file with this name anywhere.
drafts/ # A "drafts" directory anywhere.
/requirements.txt # Top-level "docs/requirements.txt".
*.py # Any file with this extension anywhere.
!/foo/example.py # But keep this particular file.
@@ -310,8 +313,6 @@ exclude_docs: |
This follows the [.gitignore pattern format](https://git-scm.com/docs/gitignore#_pattern_format).
Note that `mkdocs serve` does *not* follow this setting and instead displays excluded documents but with a "DRAFT" mark. To prevent this effect, you can run `mkdocs serve --clean`.
The following defaults are always implicitly prepended - to exclude dot-files (and directories) as well as the top-level `templates` directory:
```yaml
@@ -329,6 +330,23 @@ exclude_docs: |
!.assets # Don't exclude '.assets' although all other '.*' are excluded
```
### draft_docs
NEW: **New in version 1.6.**
This config defines patterns of files (under [`docs_dir`](#docs_dir)) to be treated as a draft. Draft files are available during `mkdocs serve` and include a "DRAFT" mark but will not be included in the build. To prevent this effect and make "serve" behave the same as "build", you can run `mkdocs serve --clean`.
Example:
```yaml
draft_docs: |
drafts/ # A "drafts" directory anywhere.
_unpublished.md # A md file ending in _unpublished.md
!/foo_unpublished.md # But keep this particular file.
```
This follows the [.gitignore pattern format](https://git-scm.com/docs/gitignore#_pattern_format).
### not_in_nav
NEW: **New in version 1.5.**