# markdown/no-duplicate-headings

> Disallow duplicate headings in the same document

Sites that render Markdown create an anchor for each heading. Two headings with the same text get anchors like `#options` and `#options-1`, and which is which changes as soon as a section moves. A table of contents with the same entry twice doesn't help a reader either.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. It needs an ESLint config that says which files are in the language:

{/* skip */}

```js eslint.config.js
import markdown from "@eslint/markdown";

export default [
  {
    files: ["**/*.md"],
    plugins: { markdown },
    language: "markdown/commonmark",
    rules: { "markdown/no-duplicate-headings": "error" },
  },
];
```

It also works with `markdown/gfm`.

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}

```md
# Server

## Options

# Client

## Options
```

Not reported:

{/* good */}

```md
# Server

## Server options

# Client

## Client options
```

## Options

| Option              | Default | What it does                                                        |
| ------------------- | ------- | ------------------------------------------------------------------- |
| `checkSiblingsOnly` | `false` | Only compare a heading with the others in the same parent section.  |

{/* good {"options": [{ "checkSiblingsOnly": true }]} */}

```md
# Server

## Options

# Client

## Options
```

{/* bad {"options": [{ "checkSiblingsOnly": true }]} */}

```md
# Server

## Options

## Options
```
