MkDocs: getting started with a Markdown documentation site
MkDocs turns a folder of Markdown files into a fast, searchable static documentation site. Setup, theming, and the alternatives.
MkDocs is the simplest static-site generator for project documentation that's built around Markdown. Folder of.md files in, fast searchable HTML site out. This guide gets you from zero to a deployed docs site in under 20 minutes, and covers when MkDocs is the right pick vs the alternatives.
What MkDocs is
A Python tool that:
- Reads a directory of
.mdfiles - Renders each to HTML using a Jinja2 template
- Adds navigation, search, and theming
- Outputs a static site you can host anywhere (Netlify, Vercel, GitHub Pages, S3)
That's it. No database, no plugin runtime, no CMS. Edit a.md file, runmkdocs build, deploy.
Install + start a project
pip install mkdocs
mkdocs new my-docs
cd my-docs
mkdocs serve
Openhttp://127.0.0.1:8000 — you'll see the default MkDocs starter site with one page and a default theme.
The project layout MkDocs created:
my-docs/
mkdocs.yml ← site config
docs/
index.md ← homepage
Add more.md files insidedocs/ and they become pages automatically.
Theme: install Material for MkDocs
The default theme is functional but plain. Most real-world MkDocs sites useMaterial for MkDocs, which adds search, dark mode, code-block copy buttons, and a polished design.
pip install mkdocs-material
Then inmkdocs.yml:
theme:
name: material
palette:
primary: blue
features:
- navigation.tabs
- navigation.sections
- search.suggest
- content.code.copy
Re-runmkdocs serve and you'll have a real documentation site.
Writing pages
Each.md file underdocs/ becomes a page. Sub-folders become navigation sections. Standard Markdown works:
# Page title
Intro paragraph that becomes the page summary.
## A heading
Body content with **bold**, `code`, [links](other-page.md), images:

Cross-page links use the relative.md path. MkDocs rewrites them to the right HTML route during build.
For the full Markdown syntax reference, see thecomplete Markdown syntax cheat sheet.
Material for MkDocs extensions worth enabling
markdown_extensions:
- admonition # callouts: !!! note, !!! warning
- pymdownx.details # collapsible sections
- pymdownx.superfences # nested fenced code blocks
- pymdownx.tabbed # tabbed content (e.g., per-language code samples)
- pymdownx.highlight # better syntax highlighting
- tables
- toc:
permalink: true # add # anchors to headings
That's the configuration most engineering docs sites converge on.
Build + deploy
mkdocs build # writes static HTML to site/
mkdocs gh-deploy # push to gh-pages branch (GitHub Pages)
For Netlify / Vercel:
- Build command:
mkdocs build - Publish directory:
site
For Cloudflare Pages / S3: build locally or in CI, uploadsite/ contents.
MkDocs vs the alternatives
| Tool | Language | Strengths | Pick when |
|---|---|---|---|
| MkDocs | Python | Simple, mature, best Material theme | Engineering docs, internal wikis, fast iteration |
| Docusaurus | React/JS | Versioning, i18n, React components in pages | OSS projects with versioned docs, blogs alongside docs |
| Astro Starlight | Astro | Performance, ecosystem, MDX | Modern stack, custom components |
| Hugo | Go | Fastest build times | Sites with thousands of pages |
| Jekyll | Ruby | GitHub Pages native, mature | Blogs, simple sites, sticking with the GitHub default |
| VitePress | Vue/JS | Fast dev experience, Vue components | Vue-flavored sites |
If you don't have an opinion and you want a fast result for engineering docs: MkDocs + Material is the boring-and-correct choice.
Markdown that breaks MkDocs
MkDocs renders with Python'smarkdown library (CommonMark + extensions). Things that work elsewhere but break in MkDocs:
- Discord/Slack-specific syntax (
||spoiler||, single-asterisk bold) — Markdown lives in many dialects. SeeMarkdown in Discord andMarkdown in Slack for those. - Tables with mismatched column counts — strict Python
markdownskips broken tables silently. Repair them first; seeHow to repair broken Markdown tables. - Frontmatter beyond YAML — MkDocs supports YAML frontmatter via the
metaextension; TOML doesn't work out of the box.
If you're importing existing Markdown from AI assistants or chat, run it throughMarkdown Tidy first — Tidy normalizes encoding and repairs structural issues that would otherwise break the build.
When to outgrow MkDocs
You'll know it's time to switch when:
- You need page versioning (multiple doc versions side-by-side) — Docusaurus
- You need React/JSX components in pages — Astro Starlight or Docusaurus
- You need internationalization for non-English docs — Docusaurus
- Build times exceed 30 seconds and you have thousands of pages — Hugo
For most internal-team and open-source-project docs, MkDocs handles the job for years.
Related
- What is Markdown? A complete guide — Markdown basics
- Markdown syntax cheat sheet — full reference
- README.md: a writing guide — the entry point to your repo
- GitHub Flavored Markdown — the dialect MkDocs needs to handle
Related articles
Markdown in React: rendering, sanitization, and the libraries that matter
How to render Markdown in a React app — react-markdown, MDX, and the security trade-offs. With code snippets you can paste into a project today.
GitHub Flavored Markdown: what's different from CommonMark
GitHub Flavored Markdown (GFM) extends CommonMark with tables, task lists, autolinks, strikethrough, and a few other features. Every difference, in one page.
8 common ChatGPT formatting artifacts (and how to spot them)
Eight specific formatting tics that ChatGPT (and most AI assistants) leave in their Markdown output — with examples and the easiest way to remove each.
What is Markdown? A complete guide with examples
Markdown is a lightweight markup language for plain-text formatting. This guide covers the syntax, the dialects, and how to convert Markdown to PDF, Word, and HTML.