#4092·mkdocs

Feature Request: AI-Assisted Documentation Drafting from Code Files

Author: JithunMethusahanCreated Mar 28, 2026Updated May 13, 2026

Problem

Every time users need to document a feature, they start from the same template. This is slow, repetitive, and a common pain point — including for me personally.

Proposed Solution

A hybrid AI + human system built into the MkDocs CLI with two capabilities:

1. Draft from code

A new command that reads a code file and auto-drafts a documentation page from it:

mkdocs --ai @main.py

The AI reads the file, understands what it does, and generates a properly formatted .md page — headings, admonitions, and front matter included.

2. Free & local-first model support

Use [OpenRouter](https://openrouter.ai) as the model provider so users can choose any LLM and run free models.

Why This Is Different

Existing AI tools require leaving the terminal, copying and pasting code, and manually reformatting the output. This keeps everything inside MkDocs — one command, one file, done.

Notes

  • Model/API key configurable via mkdocs.yml or env vars
  • Falls back gracefully if no key is configured
  • No breaking changes for existing users

I like to work on this

I contributed to ClickHouse. Apple corent, freecodecamp, and more. I started the development of this, so now I am working on it.