diff --git a/news/changelog-1.11.md b/news/changelog-1.11.md
index db98133f409..87241996e1a 100644
--- a/news/changelog-1.11.md
+++ b/news/changelog-1.11.md
@@ -206,3 +206,4 @@ All changes included in 1.11:
- ([#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`.
- ([#15198](https://github.com/quarto-dev/quarto-cli/issues/15198)): Fix `quarto add`, `quarto use template`, `quarto use brand` and `quarto install tinytex` failing to unzip on Windows when a Group Policy blocks running `.bat` files from the temporary folder, and when a path contains an apostrophe.
+- ([#15205](https://github.com/quarto-dev/quarto-cli/pull/15205)): Fix `contents` shortcode throwing errors in presence of rich content. (author: @benkeks)
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 >}}
+:::