Skip to content

Meta shortcode truncates multi-word values in raw HTML contexts #14159

Closed

Description

@cderv

{{< meta key >}} drops everything after the first space when the value appears in raw HTML contexts (include-after-body text blocks, raw HTML blocks). Inline paragraph usage works correctly. This is a regression introduced by #14073.

Repro

_quarto.yml:

project:
  type: website
my-value: Release Candidate

index.qmd:

---
format: html
include-after-body:
  text: |
    <script>window["test-include"] = '{{< meta my-value >}}';</script>
---

Inline: {{< meta my-value >}}

```{=html}
<script>window["test-rawblock"] = '{{< meta my-value >}}';</script>
```

Output:

Inline: Release Candidate           ← correct
window["test-rawblock"] = 'Release' ← truncated
window["test-include"] = 'Release'  ← truncated

Root Cause

#14073 (commit f6ecb11) added a text context branch to handleMeta() at src/resources/filters/quarto-pre/shortcodes-handlers.lua:270:

if type(optionValue) == "table" and #optionValue > 0 and optionValue[1].t == "Str" then
  return optionValue[1].text

For "Release Candidate" = [Str("Release"), Space, Str("Candidate")], only optionValue[1].text ("Release") is returned. The condition #optionValue > 0 matches all multi-word strings, but was intended only for single-node pandoc-native values.

Version

Works in v1.9.23, broken since v1.9.24 (first release containing f6ecb11).

Real-world Impact

quarto.org download buttons show "1.9.29 Release" instead of "1.9.29 Release Candidate" because prerelease-mode is set via include-after-body text block.

Activity

  1. added
    bug
    on Mar 5, 2026
  2. added
    shortcodes
    on Mar 5, 2026
  3. cderv commented on Mar 5, 2026

    @cderv
    MemberAuthor

    I think this is also happening because when meta is used in RawBlock context we end up in context == 'text' and we need to do special processing for inlines

    Unless

    if type(optionValue) == "table" and #optionValue > 0 and optionValue[1].t == "Str" then
      return optionValue[1].text
    

    is really important and we can't have multiple work text. 🤔

  4. added this to the v1.9 milestone on Mar 5, 2026
  5. self-assigned this
    on Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugshortcodes

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions