Skip to content

Commit 25fe2d7

Browse files
authored
Merge pull request #11149 from quarto-dev/bugfix/issue-10292
shortcodes - fix passthrough rendering when no handlers are available
2 parents 131a91a + a54eaea commit 25fe2d7

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

news/changelog-1.6.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All changes included in 1.6:
44

55
- The syntax for standard library imports in `quarto run` TypeScript files (`*.ts`) changed. Please see https://prerelease.quarto.org/docs/projects/scripts.html#deno-scripts for how to make the necessary changes.
66

7+
## Shortcodes
8+
9+
- ([#10292](https://github.com/quarto-dev/quarto-cli/issues/10292)): Improve shortcode passthrough when handlers are not available.
10+
711
## `quarto inspect`
812

913
- ([#10039](https://github.com/quarto-dev/quarto-cli/issues/10039)): `quarto inspect` properly handles `!expr` tag in metadata.

src/resources/filters/customnodes/shortcodes.lua

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,23 @@ function shortcodes_filter()
226226
}
227227
local handler = handlerForShortcode(shortcode_struct)
228228
if handler == nil then
229-
return open .. space .. name .. " " .. table.concat(raw_args, " ") .. " " .. close
229+
local strs = {}
230+
table.insert(strs, open)
231+
table.insert(strs, space)
232+
table.insert(strs, name)
233+
for _, v in ipairs(lst) do
234+
if type(v) == "string" then
235+
table.insert(strs, v)
236+
else
237+
if v.name then
238+
table.insert(strs, v.name .. "=" .. v.value)
239+
else
240+
table.insert(strs, v.value)
241+
end
242+
end
243+
end
244+
table.insert(strs, close)
245+
return table.concat(strs, "")
230246
end
231247
local result = callShortcodeHandler(handler, shortcode_struct, "text")
232248
return pandoc.utils.stringify(result)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Test
3+
format: hugo-md
4+
---
5+
6+
7+
{{< vimeo id="146022717" class="my-vimeo-wrapper-class" title="My vimeo video" >}}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: "Test"
3+
format: hugo-md
4+
_quarto:
5+
tests:
6+
hugo-md:
7+
ensureSnapshotMatches: true
8+
---
9+
10+
```{=markdown}
11+
{{< vimeo id="146022717" class="my-vimeo-wrapper-class" title="My vimeo video" >}}
12+
```

0 commit comments

Comments
 (0)