# MD081 - Inline emphasis should not be excessive

Aliases: `no-excessive-emphasis`

**Disabled by default.** Both thresholds are unset by default, so the rule emits
nothing until you set a limit. Setting a limit to `0` forbids the construct
entirely. There is no markdownlint equivalent; this is a rumdl-specific
readability rule.

## What this rule does

Flags prose that over-uses inline emphasis. AI-generated Markdown in particular
tends to sprinkle `**bold**` across running text (`**this** and **that** and
**the other**`), which adds visual noise without adding meaning and is harder to
read in both raw and rendered form.

The rule offers two independent checks:

- **`max-per-paragraph`** - flags a paragraph that contains more than this many
  emphasis spans.
- **`max-consecutive`** - flags a run of more than this many adjacent emphasis
  spans separated only by whitespace and punctuation. A connector word (e.g.
  `and`, `or`) between two spans breaks the run.

Each list item and each blockquote level is treated as its own paragraph, so
spans are never aggregated across structural boundaries.

Emphasis inside code spans, code blocks, links, HTML tags and `<code>` content,
math, and flavor-specific markup (MkDocs/MDX) is never counted, so patterns like
`foo(**args)` inside a fence or `` `**not bold**` `` do not trigger the rule.

## Why this matters

Emphasis is meaningful only when it is rare. When most noun phrases in a
paragraph are bold, the emphasis stops guiding the reader and becomes clutter.
Trimming it back improves both the raw Markdown and the rendered output.

## Configuration

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `targets` | string | `strong` | Which spans to count: `strong` (bold only), `emphasis` (italic only), or `all` (both). A combined `***bold italic***` counts once under `all`. |
| `max-per-paragraph` | integer | unset | Maximum emphasis spans allowed per paragraph. Unset disables this check; `0` forbids all emphasis in a paragraph. |
| `max-consecutive` | integer | unset | Maximum length of a run of adjacent emphasis spans. Unset disables this check; `0` forbids any emphasis. |

```toml
[MD081]
# Which spans to count: "strong" (bold), "emphasis" (italic), or "all".
targets = "strong"
# Flag a paragraph with more than this many emphasis spans (0 = off).
max-per-paragraph = 4
# Flag a run of more than this many adjacent emphasis spans (0 = off).
max-consecutive = 3
```

## Examples

Assuming `max-per-paragraph = 3`:

### Correct

```markdown
The key insight is that performance matters when choosing a **data structure**.
```

### Incorrect

```markdown
The **key insight** is that **performance** matters when **choosing** the right **data structure**.
```

Four bold spans in one paragraph exceed the limit of 3.

## Automatic fixes

None. Stripping emphasis or down-converting `**bold**` to `*italic*` changes the
meaning of the text (and `**critical**` may be deliberate), so the rule is
diagnostic only.

## Related rules

- [MD036 - Emphasis used instead of a heading](md036.md)
- [MD049 - Emphasis style should be consistent](md049.md)
- [MD050 - Strong style should be consistent](md050.md)
