Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions news/changelog-1.9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
All changes included in 1.9:

## Shortcodes

- ([#13342](https://github.com/quarto-dev/quarto-cli/issues/13342)): Ensure that the `contents` shortcode works inside metadata.
10 changes: 5 additions & 5 deletions src/resources/filters/quarto-pre/contentsshortcode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function contents_shortcode_filter()

return {
Pandoc = function(doc)
_quarto.ast.walk(doc.blocks, {
doc = doc:walk({
RawInline = function(el)
if el.format ~= "quarto-internal" then
return
Expand All @@ -44,7 +44,8 @@ function contents_shortcode_filter()
end
end
})
doc.blocks = _quarto.ast.walk(doc.blocks, {

doc = doc:walk({
Div = function(el)
if ids_used[el.attr.identifier] then
divs[el.attr.identifier] = el
Expand Down Expand Up @@ -110,13 +111,12 @@ function contents_shortcode_filter()
"Removing from document.")
return {}
end
-- replace div-context entries
doc.blocks = _quarto.ast.walk(doc.blocks, {
doc = doc:walk({
Para = handle_block,
Plain = handle_block
})
-- replace span-context entries
doc.blocks = _quarto.ast.walk(doc.blocks, {
doc = doc:walk({
RawInline = function(el)
if el.format ~= "quarto-internal" then
return
Expand Down
22 changes: 22 additions & 0 deletions tests/docs/smoke-all/2025/09/07/issue-13342.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "I wish I could write inline code in the abstract"
author: carlos
format: latex
abstract: |
This is an abstract. My fancy value is {{< contents placeholder-source >}}.
_quarto:
tests:
latex:
ensureFileRegexMatches:
- ['\{7\}\.\n\\end\{abstract\}']
- []
---

## A section

```{r}
#| include: false
my_fancy_code <- 3 + 4
```

Of course when I do it here it works. We analyze `{r} my_fancy_code` articles and find that this doesn't work at all. [`{r} my_fancy_code`]{#placeholder-source}
Loading