# all·markdown

Markdown for documentation

Markdown became the default format for technical documentation because it lets docs live in the repository, change in the same pull request as the code, and get reviewed by people rather than by nobody. The syntax is the easy part — what follows is the structure and the conventions that decide whether a docs folder stays usable at fifty files.

A typical docs page — edit it and watch the result

Result

Open the full editor Runs in this tab — nothing is uploaded.

The actual argument for it

It is not that Markdown is pleasant to write, though it is. It is that plain text in version control makes documentation reviewable.

A wiki page is edited somewhere else, by someone else, at some other time. That is three chances for it not to happen. A Markdown file in the same repository can be changed in the same pull request that changed the behaviour, and a reviewer who notices the code change but no doc change can say so before it merges.

Everything else follows from that: diffs that show which sentence changed, history that says who wrote a claim and when, and the ability to require a doc update the way you require a test.

Four kinds of page, and why mixing them hurts

The most common structural failure is a single page trying to teach, instruct, specify and explain at once. Those are four jobs with four shapes:

KindReaderShape
TutorialNew, needs a winOne path, no choices, works start to finish
How-toHas a specific taskNumbered steps, prerequisites, failure cases
ReferenceKnows what they wantComplete, consistent, boring on purpose
ExplanationWants to understandProse, context, trade-offs, no steps

A page that starts as a how-to and drifts into explanation loses the reader who came to do the task, and never satisfies the one who came to understand. Split it, and link between them.

What to standardise

Four conventions do most of the work of making a folder of files feel like one document. The rest can be left to taste.

A formatter settles the rest without a style argument: consistent bullets, renumbered lists, normalised spacing.

Front matter earns its place here

The YAML block at the top of the demo above is how a static site generator learns a page's title, description, ordering and audience without you repeating them in the prose.

---
title: Rotating an API key
description: Replace a key without downtime.
audience: operators
---

Keep the required keys to the two or three you actually use, and validate them in CI. A key that is optional in practice will be missing in half the files within a year, which means nothing can depend on it. Details on the front matter page.

Publishing it

All the common generators read the same Markdown, so this choice is reversible and not worth a long meeting:

ToolSuits
MkDocsThe shortest path from a folder of Markdown to a searchable site
DocusaurusVersioned product docs, with a components story
HugoLarge sites where build time matters
JekyllGitHub Pages with no build to configure
Nothing at allA docs/ folder browsed on GitHub, which renders Markdown already

That last row is worth taking seriously for a small project. GitHub renders Markdown, resolves relative links and provides search. A generator earns its keep at the point you need versioning, custom navigation or a domain of your own.

Keeping it honest

Where Markdown runs out

It has no cross-references, no includes, no conditional content and no variables. Generators add these as extensions, and every extension you use is a file that no longer renders correctly on GitHub or in an editor.

That trade is usually worth making for a real docs site and rarely worth making for a docs/ folder. If you find yourself needing all of them, the honest answer may be reStructuredText or AsciiDoc rather than Markdown with six plugins.

Common questions

Why write documentation in Markdown rather than a wiki?
Because it can live beside the code, in the same pull request that changed the behaviour. A wiki is edited separately, which means it is updated separately, which means eventually it is not updated. Review is the mechanism — a doc that goes stale silently is worse than no doc.
What is docs-as-code?
Treating documentation like source: plain text in version control, changed through pull requests, reviewed by people, built and published by CI. Markdown is the usual format because it diffs cleanly and needs no application to edit.
How should I organise a docs folder?
By what the reader is trying to do, not by how the software is built. Tutorials, how-to guides, reference and explanation are four different jobs with four different shapes, and mixing them into one page is the commonest structural mistake.
Which static site generator should I use?
Whichever your team will maintain. MkDocs is the shortest path from a folder of Markdown to a searchable site; Docusaurus suits versioned product docs; Hugo and Jekyll are general-purpose and fast. All four read the same Markdown, so the choice is reversible.
What should we standardise?
One heading level per file below the title, a fixed front matter shape, relative links between documents, and a line-wrap convention. Everything else can be left to taste — those four are what make a folder of files feel like one document.
How do I stop the docs going stale?
Put them where the change happens. A code change and its doc change in the same pull request gets reviewed together; a documentation ticket does not get done. Beyond that, link-check in CI and give each page an owner.