Skip to main content

Automate and preview MkDocs documentation projects with Docker.

Project description

draftmk

draftmk is an advanced command-line tool that automates the setup, management, and deployment of MkDocs-based documentation projects using Docker. It streamlines local previews, environment initialization, live editing, and supports CI/CD automation with flexible repository integration and configuration scaffolding for both public and internal documentation views.

Features

  • One-command environment bootstrap with optional Git initialization
  • CI-friendly flags: --no-git to skip Git setup, --repo to link existing repositories
  • Automatic port assignment (avoids conflicts)
  • Auto-generation of docs/index.md, mkdocs.public.yml, and mkdocs.internal.yml scaffolding
  • Colorful CLI output for improved user experience
  • Automatic Docker Compose setup via GitHub Gist download
  • Friendly preview logs and automatic browser launching
  • Supports seamless integration into CI pipelines

Installation

Install from PyPI:

pip install draftmk

Or add to a Poetry project:

poetry add draftmk

Requires Python ≥ 3.9, Docker, and Docker Compose.

Commands

init

Bootstraps a new DraftMk project.

draftmk init [--dir <directory>] [--no-git] [--repo <repository-url>]
  • Prompts for a directory name (defaults to draftmk-docs if not specified)
  • Creates .draftmk/ structure and .env with available ports
  • Generates default docs/index.md, mkdocs.public.yml, and mkdocs.internal.yml files for scaffolding
  • Downloads docker-compose.yml from a GitHub Gist
  • Optionally initializes a Git repository on the main branch unless --no-git is specified
  • If --repo is provided, links the project to the existing Git repository

up

Initializes the project (if needed), pulls images, builds containers, and opens the browser.

draftmk up

preview

Starts the full environment and shows Docker logs.

draftmk preview --open
  • --open: Launches the frontend in your default browser

view

Launches the frontend in your browser using the port defined in .env.

draftmk view

logs

Tails the last 50 lines of the .draftmk/logs/draftmk.log file.

draftmk logs

stop

Stops all DraftMk-related Docker containers.

draftmk stop

status

Shows the running status of all containers.

draftmk status

Usage Examples for CI Automation

To bootstrap a project without Git initialization (useful in CI pipelines):

draftmk init --no-git

To bootstrap and link to an existing repository:

draftmk init --repo yourusername/yourrepo

Directory Structure

After running draftmk init, you will have:

.
├── .draftmk/
│   ├── config/
│   ├── site/
│   │   ├── public/
│   │   └── internal/
│   └── logs/
├── docs/
│   └── index.md
├── mkdocs.public.yml
├── mkdocs.internal.yml
├── .env
└── docker-compose.yml

Docker Images

DraftMk uses pre-built Docker images hosted on Docker Hub:

Docker Compose Template

The CLI downloads a docker-compose.yml template from the following GitHub Gist:

Copier Template Support

DraftMk supports project scaffolding using Copier. You can generate a new documentation project structure using:

draftmk scaffold

By default, this pulls from the official template:

To use a custom template, create a .draftmk/settings.json file in your project root with the following content:

{
  "template_repo": "gh:your-org/your-template-repo"
}

This enables full customization of how your documentation project is initialized.

Requirements

  • Python ≥ 3.9
  • Docker
  • Docker Compose

License

MIT © Jonatan Mata


echo "Pura Vida & Happy Coding!";

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

draftmk-0.7.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

draftmk-0.7.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file draftmk-0.7.0.tar.gz.

File metadata

  • Download URL: draftmk-0.7.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.4.0

File hashes

Hashes for draftmk-0.7.0.tar.gz
Algorithm Hash digest
SHA256 bdd5bab2fad076da818db51d2a8dc2a1e6b559f665fee5a8283639b6023a45d9
MD5 335a33e6f54c7a5a5c96413aa9f74ac2
BLAKE2b-256 67b2f45174ae425ea4391632a793ee080e4258591408bfa0720754d940c3dc9f

See more details on using hashes here.

File details

Details for the file draftmk-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: draftmk-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.4.0

File hashes

Hashes for draftmk-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47c1f400b580f30f1b4f01147848239e59f842d0347471851ba37e8c9969c498
MD5 f7501b2bbee03c9c8a7c91539bb63a7f
BLAKE2b-256 6e109c19e23b301f94a7c0d65556fdaf67bbb5f41e0d25500fa6a0292ff01aed

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