Key-value Pair Before Identifier in Attribute
{...} attribute braces, an identifier (#id) appears after a key-value pair (key=value).
Q-2-56 — Key-value Pair Before Identifier in Attribute
Inside
{...}attribute braces, an identifier (#id) appears after a key-value pair (key=value).
What this means
The attribute specifier syntax requires the identifier (#id) to come first. This error fires when an identifier appears after a key-value pair.
The parser reports the error at the out-of-place token and adds a hint that rewrites your own attribute list in the accepted order, using the identifiers, classes and values you actually wrote.
Quarto 2 is deliberately stricter here than Pandoc’s reader, which accepts these in any order. The fixed order keeps documents consistent: identity, classes, then configuration.
How to fix
Put the identifier first, then the classes, then the key-value pairs:
[foo]{#id key=value} <!-- correct -->
[foo]{key=value #id} <!-- triggers Q-2-56 -->
This applies to every construct that takes an attribute list: spans,
images, inline code, editorial marks ([++ ], [-- ], [>> ], [!! ]),
headings, fenced divs, editorial divs and fenced code blocks.
qmd-syntax-helper convert -r attribute-ordering -i <file> rewrites
attribute lists into the accepted order for you.
Example
The parser flags this input:
[foo]{key=value #id}