From 03edb117697ce4c8b2853e5823a8004fe8b0b8db Mon Sep 17 00:00:00 2001 From: benkeks Date: Tue, 27 Oct 2026 13:18:58 +0100 Subject: [PATCH 1/2] Fix contents shortcode decoding of non-internal raw inlines Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../filters/quarto-pre/contentsshortcode.lua | 2 +- .../contents-shortcode/raw-inline.qmd | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/docs/smoke-all/contents-shortcode/raw-inline.qmd diff --git a/src/resources/filters/quarto-pre/contentsshortcode.lua b/src/resources/filters/quarto-pre/contentsshortcode.lua index 8499ce06279..63b54d7c0c2 100644 --- a/src/resources/filters/quarto-pre/contentsshortcode.lua +++ b/src/resources/filters/quarto-pre/contentsshortcode.lua @@ -76,7 +76,7 @@ function contents_shortcode_filter() return nil end local raw = quarto.utils.match("[1]/RawInline")(el) - if not raw then + if not raw or raw.format ~= "quarto-internal" then return nil end local result, data = pcall(function() diff --git a/tests/docs/smoke-all/contents-shortcode/raw-inline.qmd b/tests/docs/smoke-all/contents-shortcode/raw-inline.qmd new file mode 100644 index 00000000000..26064ab0b39 --- /dev/null +++ b/tests/docs/smoke-all/contents-shortcode/raw-inline.qmd @@ -0,0 +1,23 @@ +--- +format: html +_quarto: + tests: + html: + ensureHtmlElements: + - ["p > span#raw-paragraph", "li > span#raw-list-item", "#destination > #source"] + ensureHtmlElementContents: + selectors: ["#destination"] + matches: ["Reused content"] +--- + +`Raw paragraph`{=html} + +- `Raw list item`{=html} + +::: {#source} +Reused content +::: + +::: {#destination} +{{< contents source >}} +::: From fe489c9cdf64e71465513d7bc67f697ad7d3ff84 Mon Sep 17 00:00:00 2001 From: benkeks Date: Wed, 28 Oct 2026 14:08:18 +0100 Subject: [PATCH 2/2] Add changelog entry for contents shortcode fix --- news/changelog-1.11.md | 1 + 1 file changed, 1 insertion(+) diff --git a/news/changelog-1.11.md b/news/changelog-1.11.md index a60538ef04f..3dad7e0124f 100644 --- a/news/changelog-1.11.md +++ b/news/changelog-1.11.md @@ -194,3 +194,4 @@ All changes included in 1.11: - ([#15126](https://github.com/quarto-dev/quarto-cli/issues/15126)): Translate the `revealjs-menu-button-label` language key in French. (author: @D3ller) - ([#15140](https://github.com/quarto-dev/quarto-cli/pull/15140)): Add support for definition lists written as a `definition-list` div holding a nested bullet list, the definition list syntax of Quarto 2. - ([#15180](https://github.com/quarto-dev/quarto-cli/pull/15180)): Fix older Quarto versions failing to render with `RangeError: could not deserialize value` once a Quarto built on a newer Deno has used the same cache. Also fix a project cache that already has entries failing to clear with `Path must be a string`. +- ([#15205](https://github.com/quarto-dev/quarto-cli/pull/15205)): Fix `contents` shortcode throwing errors in presence of rich content. (author: @benkeks)