mkdocs-zip-bundle-plugin
Turn code blocks into downloadable files — for MkDocs/Material and Zensical. Tag any code block with a bundle ID and filename and a download button is injected automatically. Works with single files (direct download) or multiple files (ZIP archive).
Built to pair with mkdocs-placeholder-plugin: if your docs use interactive placeholders like @PORT@, the downloaded file will contain the user's actual values, not the defaults. (MkDocs/Material — see Using with Zensical for the Zensical caveat.)
Live demo → mkdocs-zip-bundle-plugin.daemonless.io
Features
- Single file downloads — one code block gets a direct raw file download, no ZIP needed
- Multi-file ZIP bundles — group multiple code blocks into one ZIP with a single button
- Placeholder-aware — captures the live browser state, so user-edited values are included in the download
- Nested paths — use
configs/app.yamlas a filename to create subdirectories inside the ZIP - Custom button labels — override auto-generated text per bundle
- Self-contained — ships with JSZip and default styling, no extra dependencies
Installation
pip install mkdocs-zip-bundle-plugin
Requires Python 3.8+ and MkDocs 1.4+. Download buttons require a modern browser (Chrome, Firefox, Safari, Edge).
Configuration
plugins:
- search
- zip-bundle:
include_jszip: true # set to false if you already load JSZip elsewhere
zip_label_suffix: "(.zip)" # appended to multi-file bundle button labels
Also enable the attr_list extension so MkDocs can read attributes on code blocks:
markdown_extensions:
- attr_list
- pymdownx.superfences # recommended for reliable attribute support
Usage
Add data-zip-bundle and data-zip-filename attributes to any fenced code block:
Single file
```yaml { data-zip-bundle="my-app" data-zip-filename="compose.yaml" }
services:
app:
image: my-image:latest
```
The plugin injects a Download compose.yaml button directly after the code block.
Multiple files (ZIP)
```yaml { data-zip-bundle="my-app" data-zip-filename="compose.yaml" }
services:
app:
image: my-image:latest
```
```bash { data-zip-bundle="my-app" data-zip-filename="setup.sh" }
mkdir -p /data/app
```
Both blocks share the same bundle ID. The plugin injects a single Download My App (.zip) button after the last block.
Custom button label
```yaml { data-zip-bundle="my-app" data-zip-filename="compose.yaml" data-zip-label="Download config" }
...
```
Force ZIP for a single file
```yaml { data-zip-bundle="my-app" data-zip-filename="compose.yaml" data-zip-force="true" }
...
```
Nested directories
```yaml { data-zip-bundle="my-app" data-zip-filename="config/app.yaml" }
...
```
```bash { data-zip-bundle="my-app" data-zip-filename="scripts/setup.sh" }
...
```
The ZIP will contain config/app.yaml and scripts/setup.sh preserving the directory structure.
How it works with placeholders
If you use mkdocs-placeholder-plugin, your docs can have editable values like @PORT@ or @DATA_PATH@ that users customize in the browser.
When the user clicks a download button from this plugin, the downloaded file contains whatever is currently in the code block — including any values the user has already changed. This makes it possible to offer personalized, copy-paste-ready config files directly from your documentation.
License
Metadata
Release files for mkdocs-zip-bundle-plugin 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkdocs_zip_bundle_plugin-0.3.0.tar.gz | 40.8 kB | Without provenance | Details for mkdocs_zip_bundle_plugin-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_zip_bundle_plugin-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_zip_bundle_plugin-0.3.0-py3-none-any.whl |
Total release size: 79.5 kB
Release files / mkdocs_zip_bundle_plugin-0.3.0.tar.gz
| Download URL | mkdocs_zip_bundle_plugin-0.3.0.tar.gz |
|---|---|
| Size | 40.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19870ba959d55cfda19a6f594f11415a0925ec0f656e9fbe3d32710fb118f967
|
|
BLAKE2b-256 checksum How to use checksums |
373c4bc01dec3dbfd6452ed51f3952d51c6930261d3be26b7b1a07d7cc0f29de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / mkdocs_zip_bundle_plugin-0.3.0-py3-none-any.whl
| Download URL | mkdocs_zip_bundle_plugin-0.3.0-py3-none-any.whl |
|---|---|
| Size | 38.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e52f439db647c5846eb7eb8318da6a6f4a5d7d2fa91e81bc93526ca44df12da
|
|
BLAKE2b-256 checksum How to use checksums |
cbc56d0a3dfd63b34de63fe40210b036da3b109b6b53c1f24f2b034fc662d9b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for mkdocs-zip-bundle-plugin 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.