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=valueare parsed by knitr/Quarto as one space-separated label. - Quoted value: explicit
label="my label"with interior whitespace. - Hashpipe option:
#| label: my labelinside 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¶
```Automatic fixes¶
None. Choosing a replacement (hyphenate, underscore, or collapse) is a semantic decision the rule will not make on the author's behalf.