Skip to main content

Listing Id Collision

listing
Two or more listings on the same page declare the same id; later occurrences are dropped.

Q-12-4 — Listing Id Collision

Two or more listings on the same page declare the same id; later occurrences are dropped.

What this means

Every listing on a page gets an id: either one the author set explicitly, or one Quarto assigned — listing for a page’s only listing, listing-1, listing-2, … for the entries of a listing: array. The id names the ::: {#id} div a listing renders into, and the rendered listing’s HTML element is listing-<id> (#listing-listing for the default), which CSS and anchor links target. The parser requires the ids on a page to be unique.

When two listings on the same page share an id, the first one keeps it and any later listings with the same id are dropped entirely.

Why this happens

A listing: array in front matter has two entries that explicitly set id: to the same string. (Assigned ids never collide: Quarto skips any listing-N an entry has already claimed explicitly.)

How to fix

Pick distinct ids. If you do not need a specific id for either listing, remove the id: field from both and let Quarto assign unique defaults.