rumdl 0.1.94

A fast Markdown linter written in Rust (Ru(st) MarkDown Linter)
Documentation
# MD079 - Quarto chunk labels must not contain whitespace

Aliases: `chunk-label-spaces`

**Flavor:** Quarto only. No-op for every other flavor.

## What this rule does

Flags Quarto/RMarkdown chunk labels that contain whitespace. Whitespace silently
breaks Quarto cross-references (`@fig-foo`) and produces unstable HTML anchors.

Three sources are checked:

- **Implicit positional:** multiple bare words before any `key=value` are parsed
  by knitr/Quarto as one space-separated label.
- **Quoted value:** explicit `label="my label"` with interior whitespace.
- **Hashpipe option:** `#| label: my label` inside the block body.

## Why this matters

knitr's chunk parser is permissive: ` ```{r several words} ` is accepted as a
chunk with the label `"several words"`. Downstream, `@fig-several-words` will
not resolve, and the rendered HTML anchor depends on how the engine collapses
the spaces - which differs between Quarto versions.

## Examples

### Correct

```markdown
```{r setup}
plot(1:10)
```

```{r, label=my_setup}
plot(1:10)
```

```{r}
#| label: fig-plot
plot(1:10)
```
```

### Incorrect

```markdown
```{r several words}
plot(1:10)
```

```{r, label="my label"}
plot(1:10)
```

```{r}
#| label: my label
plot(1:10)
```
```

## Automatic fixes

None. Choosing a replacement (hyphenate, underscore, or collapse) is a
semantic decision the rule will not make on the author's behalf.

## Related rules

- [MD078 - Executable Quarto chunks should have a label]md078.md