Skip to content

Fix meta shortcode truncating multi-word values in raw HTML contexts#14160

Merged
cscheid merged 2 commits intomainfrom
fix/meta-shortcode-space-truncation
Mar 6, 2026
Merged

Fix meta shortcode truncating multi-word values in raw HTML contexts#14160
cscheid merged 2 commits intomainfrom
fix/meta-shortcode-space-truncation

Conversation

@cderv
Copy link
Collaborator

@cderv cderv commented Mar 5, 2026

When {{< meta key >}} appears in raw HTML contexts (include-after-body text blocks, raw HTML blocks), multi-word values are truncated to the first word. "Release Candidate" becomes "Release".

Root Cause

Shortcodes in raw text (RawBlock, CodeBlock, include text) are resolved by an lpeg parser that calls the handler with context = "text" and then stringifies the result (customnodes/shortcodes.lua:247-248). The text branch added by #14073 checked #optionValue > 0 to handle single pandoc-native Str nodes, but this matched any non-empty Inlines list. For [Str("Release"), Space, Str("Candidate")], only optionValue[1].text was returned.

Fix

Narrow the guard to #optionValue == 1 (exact single-Str match) and add an Inlines branch using pandoc.utils.stringify() which concatenates all inline elements. The Blocks path (pandoc.write(markdown)) is unchanged, preserving #14061 line-break behavior.

Fixes #14159

@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Mar 5, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cscheid
Copy link
Collaborator

cscheid commented Mar 5, 2026

The service we use to get placeholder images seems to be failing. Another thing to replace with our own...

@cscheid cscheid merged commit 09539d1 into main Mar 6, 2026
92 of 93 checks passed
@cscheid cscheid deleted the fix/meta-shortcode-space-truncation branch March 6, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Meta shortcode truncates multi-word values in raw HTML contexts

3 participants