mkdocs
Build professional project documentation with MkDocs and Material theme. Covers site configuration, navigation, plugins, search optimization, versioning with mike, and deployment to GitHub Pages.
What this skill does
# MkDocs Documentation Skill
Build fast, beautiful project documentation with MkDocs and Material for MkDocs theme. This skill covers everything from basic setup to advanced deployment pipelines with versioning.
## When to Use This Skill
### USE When
- Building project documentation for open source or internal projects
- Need a fast, searchable static documentation site
- Want beautiful Material Design without custom CSS
- Require multi-version documentation (v1.x, v2.x, etc.)
- Deploying documentation to GitHub Pages, GitLab Pages, or Netlify
- Working with Python projects that need docs alongside code
- Need admonitions, code tabs, and content formatting
- Want simple Markdown-based documentation workflow
- Require offline-capable documentation
- Building API documentation alongside guides
### DON'T USE When
- Need complex React components in docs (use Docusaurus)
- Require auto-generated Python API docs (use Sphinx)
- Building single-page documentation (use simple HTML)
- Need document format conversion (use Pandoc)
- Require collaborative real-time editing (use GitBook)
- Building slide presentations (use Marp)
## Prerequisites
### Installation
```bash
# Using pip
pip install mkdocs mkdocs-material
# Using uv (recommended)
uv pip install mkdocs mkdocs-material
# With common plugins
pip install mkdocs mkdocs-material \
mkdocs-minify-plugin \
mkdocs-git-revision-date-localized-plugin \
mkdocs-macros-plugin \
mkdocs-glightbox \
mike
# Verify installation
mkdocs --version
```
### System Requirements
- Python 3.8 or higher
- pip or uv package manager
- Git (for git-revision plugin and mike)
- Node.js (optional, for social cards)
## Core Capabilities
### 1. Project Initialization
```bash
# Create new documentation project
mkdocs new my-project-docs
cd my-project-docs
# Project structure
# my-project-docs/
# ├── docs/
# │ └── index.md
# └── mkdocs.yml
# Or initialize in existing project
mkdir -p docs
touch docs/index.md
touch mkdocs.yml
```
### 2. Basic Configuration (mkdocs.yml)
```yaml
# mkdocs.yml - Minimal configuration
site_name: My Project Documentation
site_url: https://example.com/docs/
site_description: Comprehensive documentation for My Project
site_author: Your Name
# Repository
repo_name: username/my-project
repo_url: https://github.com/username/my-project
edit_uri: edit/main/docs/
# Theme
theme:
name: material
palette:
- scheme: default
primary: indigo
accent: indigo
toggle:
icon: material/brightness-7
name: Switch to dark mode
- scheme: slate
primary: indigo
accent: indigo
toggle:
icon: material/brightness-4
name: Switch to light mode
font:
text: Roboto
code: Roboto Mono
features:
- navigation.instant
- navigation.tracking
- navigation.tabs
- navigation.sections
- navigation.expand
- navigation.top
- search.suggest
- search.highlight
- content.tabs.link
- content.code.copy
- content.code.annotate
# Navigation
nav:
- Home: index.md
- Getting Started:
- Installation: getting-started/installation.md
- Quick Start: getting-started/quickstart.md
- Configuration: getting-started/configuration.md
- User Guide:
- Overview: guide/overview.md
- Basic Usage: guide/basic-usage.md
- Advanced: guide/advanced.md
- API Reference: api/reference.md
- FAQ: faq.md
- Changelog: changelog.md
# Plugins
plugins:
- search:
lang: en
separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;'
- minify:
minify_html: true
# Markdown extensions
markdown_extensions:
- abbr
- admonition
- attr_list
- def_list
- footnotes
- md_in_html
- toc:
permalink: true
toc_depth: 3
- pymdownx.arithmatex:
generic: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.keys
- pymdownx.magiclink:
repo_url_shorthand: true
user: username
repo: my-project
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
- pymdownx.tabbed:
alternate_style: true
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde
# Extra
extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/username
- icon: fontawesome/brands/twitter
link: https://twitter.com/username
generator: false
version:
provider: mike
# Copyright
copyright: Copyright © 2024-2026 Your Name
```
### 3. Navigation Structure
```yaml
# mkdocs.yml - Advanced navigation
nav:
- Home: index.md
- Getting Started:
- getting-started/index.md
- Installation:
- Linux: getting-started/install-linux.md
- macOS: getting-started/install-macos.md
- Windows: getting-started/install-windows.md
- Docker: getting-started/install-docker.md
- Quick Start: getting-started/quickstart.md
- Configuration: getting-started/configuration.md
- User Guide:
- guide/index.md
- Core Concepts:
- Architecture: guide/architecture.md
- Components: guide/components.md
- Data Flow: guide/data-flow.md
- Tutorials:
- Basic Tutorial: guide/tutorials/basic.md
- Advanced Tutorial: guide/tutorials/advanced.md
- Integration: guide/tutorials/integration.md
- Best Practices: guide/best-practices.md
- API Reference:
- api/index.md
- REST API: api/rest.md
- Python SDK: api/python-sdk.md
- CLI Reference: api/cli.md
- Examples:
- examples/index.md
- Basic Examples: examples/basic.md
- Advanced Examples: examples/advanced.md
- Contributing: contributing.md
- Changelog: changelog.md
- License: license.md
```
### 4. Material Theme Features
```yaml
# mkdocs.yml - Theme customization
theme:
name: material
custom_dir: docs/overrides # Custom templates
logo: assets/logo.png
favicon: assets/favicon.ico
icon:
repo: fontawesome/brands/github
admonition:
note: octicons/tag-16
warning: octicons/alert-16
danger: octicons/zap-16
tip: octicons/light-bulb-16
example: octicons/beaker-16
palette:
# Light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: deep purple
accent: deep purple
toggle:
icon: material/weather-sunny
name: Switch to dark mode
# Dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: deep purple
accent: deep purple
toggle:
icon: material/weather-night
name: Switch to light mode
features:
# Navigation
- navigation.instant
- navigation.instant.progress
- navigation.tracking
- navigation.tabs
- navigation.tabs.sticky
- navigation.sections
- navigation.expand
- navigation.path
- navigation.prune
- navigation.indexes
- navigation.top
- navigation.footer
# Table of contents
- toc.follow
- toc.integrate
# Search
- search.suggest
- search.highlight
- search.share
# Header
- header.autohide
# Content
- content.tabs.link
- content.code.copy
- content.code.select
- content.code.annotate
- content.tooltips
# Announce
- announce.dismiss
```
### 5. Admonitions and Call-outs
```markdown
<!-- docs/guide/admonitions.md -->
# Using Admonitions
MkDocs Material supports various admonition types for highlighting content.
Related in documentation
doc-consolidation
IncludedMerges ephemeral report and analysis artifacts into permanent documentation. Use when LLM-generated markdown files have accumulated and need consolidation.
pandoc
IncludedUniversal document converter for transforming Markdown to PDF, DOCX, HTML, LaTeX, and 40+ other formats. Covers templates, filters, citations with BibTeX/CSL, and batch conversion automation scripts.
sphinx
IncludedGenerate comprehensive Python documentation with Sphinx. Covers autodoc for API extraction, Napoleon for Google/NumPy docstrings, intersphinx for cross-references, and multiple output formats including HTML, PDF, and ePub.
gitbook
IncludedPublish documentation and books with GitBook including spaces, collections, variants, Git sync, collaboration, and API integration
docusaurus
IncludedBuild modern documentation websites with Docusaurus. Covers docs, blog, pages, versioning, i18n, search integration, and deployment patterns. React-based with MDX support for interactive documentation.
marp
IncludedCreate professional Markdown-based slide presentations with Marp. Covers themes, directives, speaker notes, presenter view, and export to PDF, HTML, and PPTX formats. Includes VS Code integration, CLI usage, and CI/CD automation.