From 1c0460c51de70d1e98cb1aa24b49a2ff0327ee01 Mon Sep 17 00:00:00 2001 From: Gordon Woodhull Date: Fri, 16 Jan 2026 14:15:23 -0500 Subject: [PATCH] claude: warn when cell-renderings has duplicate names When the `renderings` attribute contains duplicate names like `[dark, light, dark, light]`, only the last cell output for each name is used. This change adds a warning to alert users that their earlier outputs are being silently dropped. Fixes #13900 Co-Authored-By: Claude Opus 4.5 --- news/changelog-1.9.md | 1 + .../filters/quarto-post/cell-renderings.lua | 5 +++++ tests/docs/smoke-all/2026/01/16/13900.qmd | 21 +++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 tests/docs/smoke-all/2026/01/16/13900.qmd diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md index 14f341aa6d9..820e23d2e8d 100644 --- a/news/changelog-1.9.md +++ b/news/changelog-1.9.md @@ -32,6 +32,7 @@ All changes included in 1.9: - ([#11929](https://github.com/quarto-dev/quarto-cli/issues/11929)): Import all `brand.typography.fonts` in CSS, whether or not fonts are referenced by typography elements. - ([#13413](https://github.com/quarto-dev/quarto-cli/issues/13413)): Fix uncentered play button in `video` shortcodes from cross-reference divs. (author: @bruvellu) - ([#13508](https://github.com/quarto-dev/quarto-cli/issues/13508)): Add `aria-label` support to `video` shortcode for improved accessibility. +- ([#13900](https://github.com/quarto-dev/quarto-cli/issues/13900)): Warn when `renderings` cell option contains duplicate names. Previously, duplicate names like `[dark, light, dark, light]` would silently use only the last output for each name. ### `typst` diff --git a/src/resources/filters/quarto-post/cell-renderings.lua b/src/resources/filters/quarto-post/cell-renderings.lua index e7cd4534706..712f3ac80d9 100644 --- a/src/resources/filters/quarto-post/cell-renderings.lua +++ b/src/resources/filters/quarto-post/cell-renderings.lua @@ -38,7 +38,12 @@ function choose_cell_renderings() end local outputs = {} + local seen = {} for i, r in ipairs(renderings) do + if seen[r] then + quarto.log.warning("duplicate rendering name '" .. r .. "' in renderings; only the last cell output with each name will be used") + end + seen[r] = true outputs[r] = cods[i] end local lightDiv = outputs['light'] diff --git a/tests/docs/smoke-all/2026/01/16/13900.qmd b/tests/docs/smoke-all/2026/01/16/13900.qmd new file mode 100644 index 00000000000..0ab98dace01 --- /dev/null +++ b/tests/docs/smoke-all/2026/01/16/13900.qmd @@ -0,0 +1,21 @@ +--- +title: "Test duplicate rendering names warning" +format: html +execute: + echo: false +_quarto: + tests: + html: + printsMessage: + level: INFO + regex: "duplicate rendering name 'dark' in renderings" +--- + +```{r} +#| renderings: [dark, light, dark, light] + +plot(1, main = "Plot 1 (dark)") +plot(2, main = "Plot 2 (light)") +plot(3, main = "Plot 3 (dark)") +plot(4, main = "Plot 4 (light)") +```