mkdocs-exclude is a plugin for MkDocs that enables users to exclude files or entire directory trees from their documentation builds. It supports exclusion rules based on Unix-style wildcards (globs) or regular expressions (regexes). The current version is 1.0.2, and it is actively maintained as a solution for selective file exclusion in MkDocs projects.
pip install mkdocs-excludeNo compatibility data collected yet for this library.
Add the 'exclude' plugin to your mkdocs.yml file, specifying 'glob' or 'regex' patterns for files/directories to be excluded. Remember that 'glob:' and 'regex:' lines must not start with a dash, but the patterns under them must start with a dash. Quote patterns that begin with punctuation marks.
Monitor the MkDocs 2.0 development and its plugin API for potential future migration strategies. Consider 'ProperDocs' as a drop-in replacement for MkDocs 1.x to avoid immediate breaking changes if you need to stay on MkDocs 1.x features.
Ensure that `glob:` and `regex:` are directly under `exclude:`, and each pattern beneath them starts with a hyphen (`-`) followed by a space. Quote any pattern starting with a punctuation mark (e.g., `"*.tmp"`). For regex, use single quotes (`'`) to avoid issues with backslash escapes.
Review the MkDocs documentation for `exclude_docs` to compare its capabilities with `mkdocs-exclude`. If `exclude_docs` suffices, you may not need this plugin. `mkdocs-exclude` offers more explicit glob/regex control which might be preferred in some cases.
Ensure that the `glob:` and `regex:` keys are indented correctly under `exclude:`, and that each pattern within those lists starts with a hyphen and a space (`- pattern`).
Enclose any patterns that begin with punctuation marks in quotes. For example, change `*.tmp` to `"*.tmp"` in glob patterns, or `'^.*\.bak$'` for regex patterns to preserve backslashes.
Verify that `exclude:` is listed directly under the `plugins:` section in your `mkdocs.yml`. Double-check your `glob` and `regex` patterns against your file structure and test them to ensure they accurately target the files you intend to exclude. Remember glob is Unix-style, and regex is Python's regex flavor.