Markdown Style Guide

Written by Last updated

A Markdown style guide is a short list of decisions your project makes once, so every document looks the same: heading case, bullet character, emphasis, code fence style, line wrapping, file names. Markdown allows several of these, so someone has to pick.

Below are the choices, a recommended default for each, and a STYLE.md you can paste into your repository.

Looking for the rules that stop Markdown from breaking? See Markdown Best Practices. This page is for the choices that are left once those are followed. New to Markdown? Start with Markdown Basics.

Open EditorDownload PDF

The choices to make

Each row is a place where Markdown accepts more than one style. The default column is a suggestion that works for most projects and is easy to lint. Pick one, write it down, and enforce it.

Choice Options Suggested default markdownlint
Heading marker # Title (ATX) or underlined (setext) # style. Setext only goes to H2. MD003
Heading case Title Case or Sentence case Sentence case. Easier to keep consistent. none
Bullet character -, *, + - MD004
Numbered lists 1. 1. 1. or 1. 2. 3. 1. for every item. Inserting a step changes one line in the diff. MD029
Bold and italic **bold** or __bold__, *it* or _it_ **bold** and *italic* MD049, MD050
Code fences Backticks or tildes, or indented code Backticks, with a language MD046, MD048
Horizontal rule ---, ***, ___ --- MD035
Line wrapping None, one sentence per line, or fixed width One sentence per line MD013
Line breaks Two trailing spaces, \ or <br> \ MD009
Links Inline [text](url) or reference [text][id] Inline. Reference style when the same URL repeats. MD052, MD053
Emphasis vs headings Bold line vs real heading Real heading (see best practices) MD036

Heading case: Title Case or Sentence case#

Both are fine, but they fail differently. Sentence case has one rule: capitalize the first word and proper nouns. Title Case needs a decision about every small word ("and", "of", "with"), so it drifts. If you have no existing convention, use Sentence case. No linter checks this, so write it down and check it in review.

Numbered lists: 1. 1. 1. or 1. 2. 3.#

Markdown renders the same list either way, because only the first number sets the start. Numbering every item 1. means inserting a step changes one line. Numbering in sequence reads better in the raw file. markdownlint's MD029 can enforce either.

Line wrapping#

A single newline inside a paragraph renders as a space, so wrapping changes only the Git diff. One sentence per line gives the smallest diffs. The trade-off is that raw files look ragged in an editor without soft wrap. The details are in the line-wrapping rule.

File and folder names

Names are part of the style because they become URLs on most docs sites and links inside the repo.

Convention Suggested Why
Case lowercase Linux and the web are case-sensitive. Setup.md and setup.md can be different files, and a link written the other way breaks on a case-sensitive host.
Word separator hyphen: installation-guide.md Hyphens read as word breaks in URLs. Spaces become %20.
Name by purpose, not date or version api-reference.md, not final-v2.md. Versions belong in Git.
Index file README.md in the repository root or docs/, or index.md if your site generator expects it GitHub shows a README.md in the root, docs or .github. Check what your site generator expects.
Images in images/ or beside the page that uses them, with descriptive names login-error.png, not Screenshot 2026-10-03.png.

A simple layout:

docs/
β”œβ”€β”€ getting-started.md
β”œβ”€β”€ guides/
β”œβ”€β”€ reference/
β”œβ”€β”€ examples/
└── images/

Keep one source of truth. Instead of repeating the install steps on three pages, write them once and link to them.

Writing conventions

These are the parts of a style guide that a linter cannot check, so write them down.

  • Terminology. Pick one name per thing and list it. If it is "Markdown file", do not alternate with "Markdown document" and "Markdown page" unless they mean different things. A short glossary table in your style guide settles most arguments.
  • Voice. Active voice and second person for instructions: "Save the file", not "The file should be saved".
  • Commands and filenames. Put commands, file names, keys and config options in backticks. Use <kbd> for key presses only if your renderer allows it.
  • First use of a term. Explain it or link to a page about it once, then use it plainly.
  • Examples. Use realistic values, not foo and bar, where the reader needs to copy the result.
  • UI text. Match the label exactly as shown in the product, and bold it: click Save.

Copy this: a STYLE.md for your repository

Paste this into STYLE.md or docs/style.md and change the choices that do not fit.

# Documentation style

## Headings

- One H1 per file. Use `#` style headings, in order, with no skipped levels.
- Sentence case: "Install the app", not "Install The App".

## Lists

- Bullets use `-`.
- Numbered lists use `1.` for every item.

## Text

- Bold: `**text**`. Italic: `*text*`.
- Commands, file names and config keys go in `code`.
- Use "Markdown file", never "Markdown page" or "Markdown document".

## Code

- Fenced with backticks, always with a language (`text` for plain output).

## Links and images

- Link text describes the destination. Never "here".
- Every image has alt text.
- Use relative links inside this repository.

## Layout

- One sentence per line.
- File names: lowercase, hyphens, named by purpose.
- Images live in `docs/images/`.

## Checks

- `npx markdownlint-cli2 "**/*.md"` must pass before merge.

This file passes the markdownlint config below with no errors.

Enforce it with markdownlint#

A .markdownlint.json that matches the defaults above:

{
  "default": true,
  "MD003": { "style": "atx" },
  "MD004": { "style": "dash" },
  "MD009": { "br_spaces": 0 },
  "MD013": false,
  "MD029": { "style": "one" },
  "MD035": { "style": "---" },
  "MD046": { "style": "fenced" },
  "MD048": { "style": "backtick" },
  "MD049": { "style": "asterisk" },
  "MD050": { "style": "asterisk" }
}

MD009 with br_spaces set to 0 flags every trailing space, including a two-space line break, which matches the \ default above. Add npx markdownlint-cli2 "**/*.md" to your CI so style is checked on every pull request.

If you also use Prettier, check that its proseWrap setting agrees with your wrapping choice. The default, preserve, leaves your line breaks alone. always and never rewrap paragraphs, so they would fight a one-sentence-per-line rule.

For the portability rules behind these settings, see the portability rules.

Frequently Asked Questions

  1. 1

    Does every project need a Markdown style guide?

    Not a long one. Once more than one person edits the docs, a one-page STYLE.md plus a markdownlint config saves most of the review comments about formatting.

  2. 2

    What is the difference between a style guide and best practices?

    Best practices are rules that keep Markdown portable and accessible, such as one H1 and alt text. A style guide covers choices where several styles are valid, such as bullet character and heading case. See the best practices page.

  3. 3

    Title Case or Sentence case for headings?

    Either works if you stay consistent. Sentence case is easier to keep consistent because it has fewer exceptions.

  4. 4

    Should file names use hyphens or underscores?

    Hyphens, in lowercase. They read as word breaks in URLs, and lowercase avoids broken links on case-sensitive systems.

  5. 5

    Can I adopt an existing style guide instead of writing my own?

    Yes. The Google developer documentation style guide and the Microsoft Writing Style Guide are public, and you can say "we follow it, except for ..." in your own STYLE.md.