fix(llms): expand shortcodes inside llms-keyed conditional content#14567
Open
cderv wants to merge 2 commits into
Open
fix(llms): expand shortcodes inside llms-keyed conditional content#14567cderv wants to merge 2 commits into
cderv wants to merge 2 commits into
Conversation
…14563) A shortcode placed inside a content-visible/content-hidden block keyed on when-format/unless-format="llms-txt" aborted the render with a fatal internal error. The llms pre-filter resurrected the conditional block's parse-time snapshot (original_node), whose shortcodes were never expanded; for html-hidden blocks the live slot had been cleared at parse, so the unexpanded snapshot was the only surviving copy and the leftover Shortcode node reached the post-phase render placeholder. Select the content source per case: for llms-only blocks expand shortcodes on the resurrected snapshot; for html-only blocks use the already-processed live slot instead of the stale snapshot.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a shortcode appears inside a
content-visible when-format="llms-txt"block (or anycontent-hidden/unless-formatvariant) in a website withllms-txt: true, rendering aborts with a fatal internal error.Root Cause
content-hidden.luasnapshotsoriginal_nodeat parse time (before shortcode expansion) and clears the livenode.contentfor html-hidden blocks — an intentional invariant from #4867. Thellms-conditional-content.luahandler always resurrectedoriginal_node:clone()regardless of direction, re-injecting unexpandedShortcodenodes. Those reached the post-phase render placeholder, which callsinternal_error().Fix
The handler now selects the content source per direction. For llms-only blocks (html-hidden), the live slot was cleared, so
original_nodeis the only surviving copy;process_shortcodes()is called on the resurrected clone to expand shortcodes the main pass never saw. For html-only blocks (llms-hidden), the live slot already holds fully-processed content;tbl.node:clone()is used instead of the stale snapshot.Fixes #14563