A plugin for MkDocs plugin that allows you to add files from outside your `docs_dir`.
Project description
mkdocs-extrafiles
mkdocs-extrafiles is a lightweight MkDocs plugin that allows you to add files and directories from outside MkDocs document directory (docs_dir) to your MkDocs site build.
Features
- Pull individual files or glob patterns from anywhere outside your
docs_dir. - Resolve relative paths against the MkDocs configuration directory.
- Create real source
Fileobjects at build time. - Automatically watch added sources during live reload (
mkdocs serve).
Installation
From PyPI
pip install mkdocs-extrafiles
or, with astral-uv:
uv add mkdocs-extrafiles
From source
git clone https://github.com/your-username/mkdocs-extrafiles.git
cd mkdocs-extrafiles
pip install .
Quickstart
srcaccepts absolute paths or paths relative to the MkDocs config file.destaccepts relative paths to thedocs_dir; during a build they are created insite_dir.
Glob patterns (*, ?, []) require dest to end with / to indicate a directory target.
Configuration
Enable the plugin and list the external sources inside mkdocs.yml:
plugins:
- search
- extrafiles:
files:
- src: README.md # file
dest: external/README.md
- src: LICENSE # file -> rename/relocate
dest: external/LICENSE.txt
- src: assets/** # glob (copies all matches)
dest: external/assets/ # must end with '/' to indicate a directory
Behavior
mkdocs serve: Sources are streamed directly; nothing is copied intodocs_dir, but live reload will watch the resolved absolute paths.mkdocs build: Virtual files are materialized intosite_dir, so deployments that publish only the build output still include the added sources.- Missing sources will result in a
FileNotFoundErrorexception.
Troubleshooting
If you are using mkdocs-gen-files then you must place extrafiles after mkdocs-gen-files in your plugin settings.
plugins:
- search
- gen-files:
scripts:
- gen_ref_pages.py
- extrafiles:
files:
- src: ../README.md
dest: extras/README.md
Developer Guide
Set up a development environment with uv:
uv sync --all-extras --all-groups
uv run pytest tests
uv run ruff check
uv run ruff format
Key Development Principles
- Maintain 100% passing tests, at least 80% test coverage, formatting, and linting before opening a pull request.
- Update docstrings alongside code changes to keep the generated reference accurate.
Document Generation
Documentation is generated using MkDocs. The technical reference surfaces the reStructuredText style docstrings from the package's source code.
uv sync --group docs
# Run the development server
uv run mkdocs serve -f mkdocs/mkdocs.yaml
# Build the static site
uv run mkdocs build -f mkdocs/mkdocs.yaml
Contributing
Contributions are welcome! To get started:
- Fork the repository and create a new branch.
- Install development dependencies (see the developer guide).
- Add or update tests together with your change.
- Run the full test, linting, and formatting suite locally.
- Submit a pull request describing your changes and referencing any relevant issues.
For major changes, open an issue first to discuss your proposal.
License
Distributed under the GNU General Public License v3.0. See LICENSE for details.
Contact
Questions or issues? Please open an issue on the repository's issue tracker.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mkdocs_extrafiles-1.0.1.tar.gz.
File metadata
- Download URL: mkdocs_extrafiles-1.0.1.tar.gz
- Upload date:
- Size: 86.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79c2a07ca64d25765c5606e85c1bdcf78c243c84c719694a3fc420a3ed558801
|
|
| MD5 |
1cb86acca7bb4f561241eeea57d52bbf
|
|
| BLAKE2b-256 |
188432abff96515cd382ab2400d832ad8beeb6e5f729dc5d3ece9dce03acf3a9
|
Provenance
The following attestation bundles were made for mkdocs_extrafiles-1.0.1.tar.gz:
Publisher:
release.yaml on paddy74/mkdocs-extrafiles
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mkdocs_extrafiles-1.0.1.tar.gz -
Subject digest:
79c2a07ca64d25765c5606e85c1bdcf78c243c84c719694a3fc420a3ed558801 - Sigstore transparency entry: 669016335
- Sigstore integration time:
-
Permalink:
paddy74/mkdocs-extrafiles@6da5a51d952a6d73f7e5a581038fb077512fcce1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/paddy74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@6da5a51d952a6d73f7e5a581038fb077512fcce1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mkdocs_extrafiles-1.0.1-py3-none-any.whl.
File metadata
- Download URL: mkdocs_extrafiles-1.0.1-py3-none-any.whl
- Upload date:
- Size: 31.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eef6bfdfb9165eb44bab47bdb63438dff70433029b55b844378575d7182b5c37
|
|
| MD5 |
0fbe8e6a3f781c9ee0b3336494958d1f
|
|
| BLAKE2b-256 |
c38dfb0e8b4624c88a82c750713cfbe7c9d7a2309144b1b20e16abc127ce1058
|
Provenance
The following attestation bundles were made for mkdocs_extrafiles-1.0.1-py3-none-any.whl:
Publisher:
release.yaml on paddy74/mkdocs-extrafiles
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mkdocs_extrafiles-1.0.1-py3-none-any.whl -
Subject digest:
eef6bfdfb9165eb44bab47bdb63438dff70433029b55b844378575d7182b5c37 - Sigstore transparency entry: 669016337
- Sigstore integration time:
-
Permalink:
paddy74/mkdocs-extrafiles@6da5a51d952a6d73f7e5a581038fb077512fcce1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/paddy74
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@6da5a51d952a6d73f7e5a581038fb077512fcce1 -
Trigger Event:
push
-
Statement type: