Markdown Best Practices

Writing Markdown is easy. Writing good Markdown — clear, consistent, and maintainable across a team — takes intention. This guide covers practical conventions that make your documents easier to read both in their raw source form and when rendered. These practices are drawn from widely-adopted style guides used in open-source projects and technical writing teams.

1. Document Structure

Start with a single H1

Every document should have exactly one top-level heading (# Title) that describes what the document is about. This becomes the page title in most renderers and is critical for accessibility and SEO.

Do
# API Authentication Guide ## Overview ## Getting Started
Don't
## API Authentication Guide ## Overview ## Getting Started

Use heading levels sequentially

Never skip heading levels — go from H2 to H3, not H2 to H4. This creates a proper document outline and helps screen readers navigate your content.

Do
## Installation ### Prerequisites ### Steps ## Configuration ### Environment Variables
Don't
## Installation #### Prerequisites #### Steps ## Configuration #### Environment Variables

Add a brief introduction

After the title, include 1-3 sentences explaining what this document covers and who it's for. Don't make readers guess whether this is the right document for their needs.

2. Line Length and Wrapping

There are two common approaches to line wrapping in Markdown source files:

Pick one style and use it consistently across your project. The "one sentence per line" approach is increasingly popular because it produces better git diffs — a single sentence change shows as one added and one removed line, not a full paragraph rewrite.

Tip: Git-friendly paragraphs

When writing documentation that will be reviewed in pull requests, one-sentence-per-line makes reviewers' lives significantly easier. They can comment on specific sentences without quoting entire paragraphs.

3. Consistent Formatting

Headings

Lists

Do
Steps to deploy: 1. Run the build 1. Run tests 1. Push to staging 1. Verify health checks 1. Promote to production
Don't
Steps to deploy: 1. Run the build 2. Run tests 3. Push to staging 4. Verify health checks 5. Promote to production

Emphasis

4. Links

Use descriptive link text

Link text should describe where the link goes, not just say "click here" or "this page." This helps accessibility (screen readers) and scannability.

Do
See the [authentication guide](./auth.md) for setup instructions. Read the [API rate limiting docs](./rate-limits.md) before deploying.
Don't
Click [here](./auth.md) for the auth guide. For rate limiting info, see [this page](./rate-limits.md).

Use reference links for repeated URLs

When a URL appears multiple times or when inline links make text hard to read, use reference-style links:

This feature requires [Node.js 18+][node] and [TypeScript 5+][ts]. See the [installation guide][install] for setup details. [node]: https://nodejs.org/ [ts]: https://www.typescriptlang.org/ [install]: ./docs/install.md

Relative vs. absolute links

Within a repository or documentation site, use relative links (./other-doc.md) so links work regardless of where the docs are hosted. Use absolute URLs only for external resources.

5. Code Blocks

Always specify the language

Even when you think the language is obvious, specifying it enables syntax highlighting and helps readers identify what they're looking at:

Do
```bash npm install express ```
Don't
``` npm install express ```

Keep examples runnable

Code examples should work when copy-pasted. Include necessary imports, variable declarations, and context. If an example is a fragment, indicate that clearly:

```javascript // In your express route handler: app.get('/api/users', async (req, res) => { const users = await db.users.findAll(); res.json(users); }); ```

Use appropriate block types

6. Images and Media

7. Tables

8. File Organization

For larger documentation projects, adopt a clear file structure:

docs/ ├── README.md # Entry point, table of contents ├── getting-started.md # Quick start guide ├── installation.md # Detailed setup ├── configuration.md # Config reference ├── guides/ │ ├── authentication.md │ ├── deployment.md │ └── troubleshooting.md ├── api/ │ ├── overview.md │ └── endpoints.md └── images/ └── architecture.png

Name files with lowercase kebab-case. Use README.md (uppercase) as the entry point in each directory since GitHub and most platforms auto-display it.

9. Whitespace and Spacing

10. Accessibility Considerations

Preview your Markdown — Check formatting, heading structure, and rendering before publishing with MD Viewer's live preview.

Open MD Viewer