Skip to main content

Automated Documentation Project Generator - Create beautiful MkDocs documentation projects with ease

Project description

DocuFlow

PyPI version Python Support License: MIT Code style: black

Automated Documentation Project Generator - Create beautiful MkDocs documentation projects with PDF export and version management

DocuFlow is a powerful CLI tool that automates the creation of professional documentation projects using MkDocs and the Material theme. It handles everything from project setup to Git repository creation, CI/CD configuration, PDF generation, and versioned documentation deployment.

โœจ Features

Core Features

  • ๐Ÿš€ Quick Project Setup - Generate complete documentation projects in seconds
  • ๐ŸŽจ Beautiful Templates - Pre-configured MkDocs Material themes
  • ๐Ÿ”ง Git Integration - Automatic GitHub/GitLab repository creation
  • ๐Ÿ“ฆ CI/CD Ready - GitHub Actions and GitLab CI configurations included
  • ๐ŸŽฏ Multiple Templates - Choose from basic or full-featured setups
  • ๐Ÿ” Secure Authentication - Token management with keyring integration
  • ๐Ÿ“ฑ Rich CLI - Beautiful terminal interface with progress indicators

PDF Generation

  • ๐Ÿ“„ PDF Export - Generate professional PDFs from your markdown documentation
  • ๐Ÿ“š Version History - Automatically include git tag history in PDFs
  • ๐Ÿ”— Table of Contents - Clickable TOC with customizable depth
  • ๐Ÿ–ผ๏ธ Image Embedding - Base64 image encoding for standalone PDFs
  • ๐Ÿ“Š Mermaid Diagrams - Optional diagram rendering to images
  • ๐Ÿ“ฆ Multi-Section PDFs - Generate different PDFs from different doc sections
  • ๐ŸŽ Release Packages - Create ZIP files with PDFs and additional files

Version Management

  • ๐Ÿท๏ธ Versioned Docs - Full integration with mike for versioned documentation
  • ๐Ÿ”„ Git Tag Sync - Automatic alignment between git tags and documentation versions
  • ๐Ÿ“Œ Version Aliases - Support for "latest", "stable", and custom aliases
  • ๐ŸŒ Version Selector - Automatic version picker in your documentation site
  • ๐Ÿš€ Automated Deployment - CI/CD workflows handle versioned deployments automatically

๐Ÿš€ Quick Start

Installation

# Install with pip
pip install mkdocs-flow

# Or with Poetry
poetry add mkdocs-flow

# Install with PDF generation support
pip install "mkdocs-flow[diagrams]"  # Includes Mermaid diagram rendering

System Requirements for PDF Generation:

Ubuntu/Debian:

sudo apt-get install -y libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev libcairo2

macOS:

brew install cairo pango gdk-pixbuf libffi

Basic Usage

# Initialize a new documentation project
docuflow init my-awesome-docs

# Navigate to your project
cd my-awesome-docs

# Serve documentation locally
docuflow serve

# Build documentation
docuflow build

# Create a versioned release
docuflow version-create --version 1.0 --alias latest

# Generate PDFs
docuflow generate-pdf

# Deploy to GitHub/GitLab Pages (with versioning)
git push origin main
git tag 1.0.0
git push origin 1.0.0  # Triggers automatic versioned deployment

๐Ÿ“– Documentation

Commands

docuflow init [PROJECT_NAME]

Initialize a new documentation project with interactive setup.

Options:

  • --name TEXT - Project name
  • --description TEXT - Project description
  • --author TEXT - Author name
  • --email TEXT - Author email
  • --git-provider [github|gitlab] - Git provider
  • --private - Create private repository
  • --template [basic|full] - Project template
  • --no-remote - Skip remote repository creation
  • --config-file PATH - Configuration file

Example:

docuflow init my-project \
  --description "My awesome project documentation" \
  --author "John Doe" \
  --email "john@example.com" \
  --template full \
  --private

docuflow serve [PROJECT_PATH]

Serve documentation locally for development.

Example:

docuflow serve ./my-project

docuflow build [PROJECT_PATH]

Build documentation site.

Options:

  • --clean - Clean build directory before building

Example:

docuflow build --clean

docuflow deploy [PROJECT_PATH]

Deploy documentation to GitHub/GitLab Pages.

Options:

  • --force - Force deployment without confirmation

Example:

docuflow deploy --force

docuflow config

Manage DocuFlow configuration and authentication tokens.

docuflow templates

List available project templates.

docuflow version-create

Create a new documentation version with mike and git tag.

Options:

  • --version, -v TEXT - Version number (e.g., 1.0, 1.0.0)
  • --title TEXT - Version title
  • --alias, -a TEXT - Version aliases (can be used multiple times)
  • --no-tag - Do not create git tag
  • --message, -m TEXT - Git tag message

Example:

# Create version 1.0 with "latest" alias
docuflow version-create --version 1.0 --alias latest

# Create version with custom title and multiple aliases
docuflow version-create \
  --version 2.0 \
  --title "Version 2.0 - Major Release" \
  --alias latest \
  --alias stable

# Interactive mode
docuflow version-create

docuflow version-list

List all versions and check alignment between git tags and mike versions.

Example:

docuflow version-list

Shows a table with:

  • โœ“ Aligned versions (both git tag and mike version exist)
  • โš  Git-only tags (no corresponding mike version)
  • โš  Mike-only versions (no corresponding git tag)

docuflow generate-pdf

Generate PDF documentation from markdown files.

Arguments:

  • SECTIONS - Section names to generate (optional, defaults to all)

Options:

  • --tag, -t TEXT - Git tag/version to use
  • --output-dir PATH - Output directory (default: pdfs)

Examples:

# Generate all configured PDFs
docuflow generate-pdf

# Generate specific sections
docuflow generate-pdf user-guide api-reference

# Generate for a specific version
docuflow generate-pdf --tag 1.0.0

# Custom output directory
docuflow generate-pdf --output-dir releases/v1.0

Generated projects also include a standalone generate_pdf.py script:

# In your project directory
poetry run python generate_pdf.py --tag 1.0

Templates

Basic Template

  • Minimal setup with essential pages and plugins
  • Plugins: search, awesome-pages, mermaid2
  • Perfect for simple documentation needs

Full Template

  • Comprehensive structure with all features enabled
  • Plugins: search, awesome-pages, mermaid2, git-revision-date-localized, minify
  • Advanced features and optimizations included

Configuration

DocuFlow stores configuration in ~/.docuflow/config.yml. You can customize:

  • Default git provider (GitHub/GitLab)
  • Default theme and template
  • Repository visibility preferences
  • Plugin configurations

Authentication

DocuFlow supports secure token storage using keyring:

# Configure tokens interactively
docuflow config

# Or set environment variables
export GITHUB_TOKEN="your_github_token"
export GITLAB_TOKEN="your_gitlab_token"

PDF Configuration

Generated projects include a pdf_config.yml file for customizing PDF generation:

# PDF Export Configuration
sections:
  - name: user-guide
    title: "User Guide"
    output: "user-guide.pdf"
    docs_dir: "docs/sections/user-guide"

  - name: api-reference
    title: "API Reference"
    output: "api-reference.pdf"
    docs_dir: "docs/sections/api-reference"

  - name: full-documentation
    title: "Complete Documentation"
    output: "documentation.pdf"
    docs_dir: "docs"

# Version history settings
include_version_history: true

# Table of contents settings
include_toc: true
toc_depth: 3

# Image handling
embed_images: true

# Mermaid diagram rendering (requires playwright)
render_mermaid: false

# Release packaging
create_release_zip: false
release_includes:
  - "*.g4"
  - "*.ebnf"

Version Management with Mike

Generated projects automatically include mike configuration in mkdocs.yml:

extra:
  version:
    provider: mike

The GitHub Actions workflow is pre-configured to:

  • Deploy versioned documentation on tag pushes
  • Update the "latest" alias automatically
  • Maintain version history with a version selector

Workflow:

  1. Develop documentation on the main branch
  2. Create a version: docuflow version-create --version 1.0 --alias latest
  3. Push changes and tags: git push && git push --tags
  4. GitHub Actions automatically deploys the versioned documentation
  5. Users can select versions from the documentation site

๐Ÿ› ๏ธ Development

Setup Development Environment

# Clone the repository
git clone https://github.com/yourusername/docuflow.git
cd docuflow

# Install dependencies
poetry install

# Install pre-commit hooks
pre-commit install

# Run tests
poetry run pytest

# Run linting
poetry run black src tests
poetry run isort src tests
poetry run flake8 src tests
poetry run mypy src

Project Structure

docuflow/
โ”œโ”€โ”€ src/docuflow/              # Source code
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ cli.py                 # CLI interface
โ”‚   โ”œโ”€โ”€ config.py              # Configuration management
โ”‚   โ”œโ”€โ”€ git_manager.py         # Git operations
โ”‚   โ”œโ”€โ”€ models.py              # Data models (including PDF config)
โ”‚   โ”œโ”€โ”€ project_manager.py     # Project orchestration
โ”‚   โ”œโ”€โ”€ template.py            # Template generation
โ”‚   โ”œโ”€โ”€ export_utils.py        # Git tag & file utilities
โ”‚   โ”œโ”€โ”€ pdf_generator.py       # PDF generation engine
โ”‚   โ”œโ”€โ”€ version_manager.py     # Version management (mike)
โ”‚   โ”œโ”€โ”€ mermaid_renderer.py    # Mermaid diagram rendering
โ”‚   โ””โ”€โ”€ templates/             # Project templates
โ”‚       โ”œโ”€โ”€ export_utils.py.template
โ”‚       โ”œโ”€โ”€ generate_pdf.py.template
โ”‚       โ””โ”€โ”€ mermaid_renderer.py.template
โ”œโ”€โ”€ tests/                     # Test suite
โ”‚   โ”œโ”€โ”€ test_cli.py
โ”‚   โ”œโ”€โ”€ test_export_utils.py
โ”‚   โ”œโ”€โ”€ test_pdf_generator.py
โ”‚   โ”œโ”€โ”€ test_version_manager.py
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ docs/                      # Documentation
โ”œโ”€โ”€ pyproject.toml             # Poetry configuration
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ IMPLEMENTATION_SUMMARY.md  # Implementation details

Generated Project Structure:

When you create a project with DocuFlow, it includes:

my-project/
โ”œโ”€โ”€ docs/                      # Documentation source
โ”œโ”€โ”€ mkdocs.yml                 # MkDocs config (with mike)
โ”œโ”€โ”€ pyproject.toml             # Dependencies (includes mike)
โ”œโ”€โ”€ pdf_config.yml             # PDF generation config
โ”œโ”€โ”€ export_utils.py            # Export utilities
โ”œโ”€โ”€ generate_pdf.py            # PDF generation script
โ”œโ”€โ”€ mermaid_renderer.py        # Mermaid support
โ”œโ”€โ”€ .github/workflows/
โ”‚   โ””โ”€โ”€ deploy-docs.yml        # CI/CD with mike deployment
โ””โ”€โ”€ scripts/
    โ”œโ”€โ”€ build.sh
    โ””โ”€โ”€ serve.sh

Testing

# Run all tests
poetry run pytest

# Run with coverage
poetry run pytest --cov=src/docuflow

# Run specific test file
poetry run pytest tests/test_cli.py

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for your changes
  5. Run the test suite (poetry run pytest)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

Core Technologies

PDF & Versioning

Development Tools

๐Ÿ“ž Support

๐Ÿ†• What's New

Version 0.2.0 - PDF & Versioning Support

DocuFlow now includes comprehensive PDF generation and version management capabilities!

New Features:

  • โœ… Generate professional PDFs from markdown with version history
  • โœ… Full mike integration for versioned documentation
  • โœ… Automatic git tag and version alignment
  • โœ… Mermaid diagram rendering in PDFs
  • โœ… Multi-section PDF export
  • โœ… Release packaging with ZIP files

New Commands:

  • docuflow version-create - Create versioned releases
  • docuflow version-list - Check version alignment
  • docuflow generate-pdf - Generate PDFs

See IMPLEMENTATION_SUMMARY.md for complete implementation details and the PDF_VERSIONING_MIGRATION_GUIDE.md for the original feature specifications.


Made with โค๏ธ for the open source community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_flow-0.1.0.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_flow-0.1.0-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_flow-0.1.0.tar.gz.

File metadata

  • Download URL: mkdocs_flow-0.1.0.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for mkdocs_flow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a0814be71bc86534bccb6943474439b8b632d93ccac817e96ecd3ea69a49de75
MD5 c3a435e6ad71599f365f14915767e03c
BLAKE2b-256 8e6bff928d88878a66316a1107fb9b360db8bd89cb7a1e9f6dacca2765f449d9

See more details on using hashes here.

File details

Details for the file mkdocs_flow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_flow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for mkdocs_flow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61d245077ac505edb193747850823971ba26bbe9ec05cab7f33709364a133bad
MD5 02f08f667ba95597e995540449bc6bbe
BLAKE2b-256 ac10a1efb262c8dd9bf68373ba5ec1df60d0600650096681d0016b4ae9a10402

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page