vexy-mkdocs-output-as-input
Documentation: https://vexy.dev/vexy-mkdocs-output-as-input/
A MkDocs plugin that captures HTML output and creates "cousin" Markdown files with original frontmatter and extracted HTML content.
Features
This plugin enables powerful post-processing workflows by:
- ✅ Preserving your original Markdown structure and frontmatter
- ✅ Capturing the fully-rendered HTML output from MkDocs
- ✅ Creating new Markdown files that combine original metadata with processed HTML
- ✅ Enabling further processing by other static site generators
Installation
Install from PyPI:
uv pip install --system --upgrade vexy-mkdocs-output-as-input
Or install from source:
pip install git+https://github.com/vexyart/vexy-mkdocs-output-as-input
This also installs a CLI tool: mkdocs-output-as-input
Quick Start
Add the plugin to your mkdocs.yml:
plugins:
- search # Other plugins
- output-as-input
Build your site:
mkdocs build
Find your processed files in the stage/ directory (relative to your MkDocs project root).
Configuration
All configuration options with their defaults:
plugins:
- output-as-input:
stage_dir: stage # Output directory name (default: 'stage')
html_element: main # HTML element to extract (default: 'main')
target_tag: article # Tag to use in output (default: 'article')
include_frontmatter: true # Include YAML frontmatter (default: true)
preserve_links: false # Convert absolute to relative links (default: false)
verbose: false # Enable verbose logging (default: false)
Advanced Examples
Extract multiple elements:
plugins:
- output-as-input:
html_element: [main, aside] # Extract both main content and sidebar
Extract using CSS selectors:
plugins:
- output-as-input:
html_element: .content # Extract element with class="content"
Options Explained
| Option | Type | Default | Description |
|---|---|---|---|
stage_dir |
string | "stage" |
Directory name for output files (relative to project root) |
html_element |
string or list | "main" |
CSS selector(s) for HTML elements to extract |
target_tag |
string | "article" |
HTML tag to use in the output (replaces extracted element's tag) |
include_frontmatter |
boolean | true |
Include YAML frontmatter in output files |
preserve_links |
boolean | false |
Convert absolute links to relative (e.g., /path → ./path) |
minify |
boolean | false |
Minify HTML output (remove whitespace) |
prettify |
boolean | false |
Prettify HTML output (add indentation) |
verbose |
boolean | false |
Enable detailed logging for debugging |
How It Works
Input → Process → Output
-
Input: Your source Markdown with frontmatter
--- title: My Page author: Jane Doe --- # My Page This is my content with **markdown**.
-
MkDocs Processing: Renders to HTML as usual
<main class="md-content"> <h1>My Page</h1> <p>This is my content with <strong>markdown</strong>.</p> </main>
-
Output: Cousin file with preserved frontmatter + extracted HTML
--- title: My Page author: Jane Doe --- <article class="md-content"> <h1>My Page</h1> <p>This is my content with <strong>markdown</strong>.</p> </article>
Use Cases
🔄 Multi-Stage Documentation Pipeline
Process documentation through MkDocs first, then feed to another SSG:
# mkdocs.yml
plugins:
- output-as-input:
stage_dir: hugo/content
# Then run:
# mkdocs build && hugo build
📝 Content Extraction
Extract just the article content without theme wrapper:
plugins:
- output-as-input:
html_element: article
target_tag: div
🎨 Custom Post-Processing
Preserve MkDocs rendering while preparing for custom templates:
plugins:
- output-as-input:
stage_dir: _includes
html_element: main
target_tag: section
Examples
Basic Example
# mkdocs.yml
site_name: My Documentation
plugins:
- output-as-input
Advanced Example
# mkdocs.yml
site_name: My Documentation
theme:
name: material
plugins:
- search
- output-as-input:
stage_dir: processed
html_element: article.md-content__inner
target_tag: main
verbose: true
# Process specific content area from Material theme
Integration Example
Using with other tools in a documentation pipeline:
#!/bin/bash
# build.sh
# Stage 1: Build with MkDocs + plugins
mkdocs build
# Stage 2: Process staged output
python post_process.py stage/
# Stage 3: Build final site
hugo --contentDir=stage/
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/vexyart/vexy-mkdocs-output-as-input
cd vexy-mkdocs-output-as-input
# Automated setup (recommended)
./scripts/dev-setup.sh
# Or manual setup
make dev-setup
Common Development Tasks
# Run all tests and code quality checks
make test
# Build the package
make build
# Create a new patch release
make release
# Clean build artifacts
make clean
# View all available commands
make help
Running Tests
# Run all tests with script
./scripts/test.sh
# Or run individual components
pytest --cov=mkdocs_output_as_input --cov-report=html
ruff check src tests
mypy src
Build and Release
The project uses automated build and release workflows:
-
Local Release Script:
./scripts/release.sh patch # Creates v1.0.1 -> v1.0.2 ./scripts/release.sh minor # Creates v1.0.2 -> v1.1.0 ./scripts/release.sh major # Creates v1.1.0 -> v2.0.0
-
GitHub Actions: Automatically triggered on git tags
- Runs tests on multiple platforms (Linux, Windows, macOS)
- Builds Python packages and standalone binaries
- Publishes to PyPI using trusted publishing
- Creates GitHub releases with artifacts
-
Standalone Binaries: Available for download from releases
- Linux:
mkdocs-output-as-input-ubuntu-latest - Windows:
mkdocs-output-as-input-windows-latest.exe - macOS:
mkdocs-output-as-input-macos-latest
- Linux:
See BUILD_RELEASE.md for detailed documentation.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- 📧 Email: you@example.com
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
Metadata
Release files for vexy-mkdocs-output-as-input 1.0.11
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 |
|---|---|---|---|---|
| vexy_mkdocs_output_as_input-1.0.11.tar.gz | 22.5 kB | Without provenance | Details for vexy_mkdocs_output_as_input-1.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vexy_mkdocs_output_as_input-1.0.11-py3-none-any.whl | Python 3 | none | any | Details for vexy_mkdocs_output_as_input-1.0.11-py3-none-any.whl |
Total release size: 36.2 kB
Release files / vexy_mkdocs_output_as_input-1.0.11.tar.gz
| Download URL | vexy_mkdocs_output_as_input-1.0.11.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f19d5573ad5c2179adc432a6a082e6d2862c7ca50a8aac2d45f7eb13937b4eb1
|
|
BLAKE2b-256 checksum How to use checksums |
4d6cc0f2938227f9165aabf359a5c643731771f1473f3c3be31f4df379b315fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / vexy_mkdocs_output_as_input-1.0.11-py3-none-any.whl
| Download URL | vexy_mkdocs_output_as_input-1.0.11-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa6e280ae4c4dc6fc4e11b7f15f36677905427ec07c74d2355894ae526ec1781
|
|
BLAKE2b-256 checksum How to use checksums |
b59746d9780ec1419ac7e234ebbe2592f3c23b4fc5ea8a5aa0e9b5bba457dbae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for vexy-mkdocs-output-as-input 1.0.11
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.