---
title: template-heading-order
description: Reports a Template heading outside its declared relative order.
---

[← All Rules](/rules/)

## What it does

Reports a declared heading that exists but appears before or after the position allowed by the Template.

## Why it matters

The Template defines a stable reading order as well as a set of headings.

## Examples

For a Template that declares `Context` before `Decision`:

### Non-passing

```md title="docs/decisions/0001-choice.md"
# Choice

## Decision

## Context
```

### Passing

```md title="docs/decisions/0001-choice.md"
# Choice

## Context

## Decision
```

## When it applies

This Rule belongs to the configurable `document-types` group. It applies to required headings and to optional sections that are present.

## References

See [Presswork Configuration](/configuration/#documenttypes) for Templates and [`src/template.ts`](https://github.com/evilkiwi/presswork/blob/main/src/template.ts) for heading-order evaluation.
