MkDocs Installation Guide#
This guide walks you through installing MkDocs Material theme and all required plugins for this documentation site.
Prerequisites#
Before starting, ensure you have:
- Python 3.8 or higher installed
- uv package manager installed
- Git installed (for git-revision-date plugin)
- Virtual environment activated
Verify your setup:
python --version # Should be 3.8+
uv --version # Should show uv version
git --version # Should show git version
Installation Steps#
Step 1: Install MkDocs Material Theme#
The Material theme is the foundation of this documentation site.
Expected output:
Resolved XX packages in XXXms
Installed X packages in X.XXs
+ mkdocs-material==X.X.X
+ mkdocs==X.X.X
+ ... (other dependencies)
Verify installation:
Should show: mkdocs, version X.X.X from ... (Python 3.X)
Step 2: Install Required Plugins#
Install all plugins used in mkdocs.yml:
2.1 Minify Plugin (HTML/CSS/JS optimization)#
What it does: Minifies HTML, CSS, and JavaScript for faster page loading.
2.2 Git Revision Date Plugin (Last updated dates)#
What it does: Shows "last updated" dates on pages based on git commit history.
Requirement: Your documentation must be in a git repository.
2.3 Glightbox Plugin (Image lightbox)#
What it does: Adds click-to-zoom functionality and image galleries.
2.4 Material Imaging (Image optimization)#
What it does: Compresses images, generates WebP versions, optimizes page load.
Additional requirements: System dependencies (see Step 3)
Step 3: Install System Dependencies (For Image Optimization)#
The Material imaging plugin requires system libraries.
Install MSYS2:
- Download from msys2.org
- Run installer with default options
- Open MSYS2 UCRT64 terminal (blue icon)
Update MSYS2:
If terminal closes, reopen and run:
Install Cairo Graphics and pngquant:
Dependencies Installed Automatically
The cairo package automatically installs: freetype, libffi, libjpeg-turbo, libpng, and zlib as dependencies.
Add to PATH: 1. Open Windows Settings → System → About → Advanced system settings 2. Environment Variables → Edit "Path" under User variables 3. Add: C:\msys64\ucrt64\bin 4. Restart terminal/VS Code
Verify:
Install Homebrew (if not installed):
Install image processing libraries:
Verify:
Step 4: Create Custom CSS File#
The configuration references a custom stylesheet that needs to exist.
# Create directories
mkdir -p docs/stylesheets
# Create empty CSS file (we'll add styles later)
touch docs/stylesheets/extra.css
Or on Windows (PowerShell):
New-Item -Path "gardening-docs\docs\stylesheets" -ItemType Directory -Force
New-Item -Path "gardening-docs\docs\stylesheets\extra.css" -ItemType File
Step 5: Verify Installation#
Test that everything is installed correctly:
Expected output:
INFO - Cleaning site directory
INFO - Building documentation to directory: D:\...\site
INFO - Documentation built in X.XX seconds
If successful, serve locally:
Expected output:
INFO - Building documentation...
INFO - Cleaning site directory
INFO - Documentation built in X.XX seconds
INFO - [XX:XX:XX] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO - [XX:XX:XX] Serving on http://127.0.0.1:8000/
Open browser to http://127.0.0.1:8000/ to view the documentation.
Complete Installation Command List#
For quick reference, here are all installation commands:
# Python packages
uv add mkdocs-material
uv add mkdocs-minify-plugin
uv add mkdocs-git-revision-date-localized-plugin
uv add mkdocs-glightbox
uv add "mkdocs-material[imaging]"
# Create CSS directory and file
mkdir -p docs/stylesheets
touch docs/stylesheets/extra.css
# System dependencies (platform-specific - see Step 3 above)
# Verify
cd gardening-docs
mkdocs build
mkdocs serve
Troubleshooting#
Common Installation Issues#
ERROR: 'minify' plugin not found
Problem: mkdocs-minify-plugin not installed
Solution:
ERROR: 'git-revision-date-localized' plugin not found
Problem: Git revision date plugin not installed
Solution:
ERROR: 'glightbox' plugin not found
Problem: Glightbox plugin not installed
Solution:
ERROR: 'optimize' plugin not found
Problem: Material imaging extra not installed
Solution:
Build fails with 'cairo' error
Problem: Cairo Graphics not installed or not in PATH
Solution: See Step 3 for platform-specific Cairo installation
ERROR: Config file 'stylesheets/extra.css' does not exist
Problem: Custom CSS file doesn't exist
Solution:
uv: command not found
Problem: uv package manager not installed
Solution:
Git revision dates not showing
Problem: Not in a git repository or no commits
Solution:
Optional Enhancements#
Install Mike for Version Management#
If you want to host multiple documentation versions (v1.0, v2.0, etc.):
Usage:
# Deploy version 1.0
mike deploy 1.0 latest --update-aliases
# Deploy version 2.0
mike deploy 2.0 latest --update-aliases
# Serve versioned docs
mike serve
Install Additional Extensions#
Add more functionality as needed:
# PDF export
uv add mkdocs-pdf-export-plugin
# Macros for variables in markdown
uv add mkdocs-macros-plugin
# Include markdown files
uv add mkdocs-include-markdown-plugin
Development Workflow#
Once installed, your typical workflow:
# 1. Activate virtual environment
.venv\Scripts\activate # Windows
source .venv/bin/activate # Unix/Mac
# 2. Navigate to docs directory
cd gardening-docs
# 3. Start development server
mkdocs serve
# 4. Edit documentation files
# Server auto-reloads on file changes
# 5. Build for production
mkdocs build
# 6. Deploy to GitHub Pages (optional)
mkdocs gh-deploy
Keeping Dependencies Updated#
Update all packages periodically:
# Update all packages
uv sync --upgrade
# Or update specific package
uv add --upgrade mkdocs-material
Check for outdated packages:
Package Reference#
| Package | Purpose | Required? |
|---|---|---|
mkdocs-material | Material theme | ✅ Required |
mkdocs-minify-plugin | Minify HTML/CSS/JS | ✅ Required |
mkdocs-git-revision-date-localized-plugin | Show update dates | ✅ Required |
mkdocs-glightbox | Image lightbox | ✅ Required |
mkdocs-material[imaging] | Image optimization | ✅ Required |
| Cairo Graphics (system) | Image processing | ✅ Required |
| pngquant (system) | PNG compression | ✅ Required |
mike | Version management | ⚪ Optional |
Next Steps#
After successful installation:
- ✅ Read the extensions guide: MkDocs Extensions Guide
- ✅ Set up image processing: Image Processing Setup
- ✅ Start writing documentation: Edit files in
docs/ - ✅ Customize styling: Edit
docs/stylesheets/extra.css - ✅ Configure theme: Modify
mkdocs.yml
Additional Resources#
- MkDocs Official Documentation
- Material for MkDocs Documentation
- UV Package Manager Documentation
- MSYS2 Documentation (Windows users)
- Homebrew Documentation (macOS users)
Last Updated: 2025-12-12 Maintained By: Gardening App Documentation Team