I have
Bug description
Tangentially to #14562, I discovered another issue involving when-format="llms-txt" and shortcodes resolution.
In a website project with llms-txt: true, placing any shortcode inside a conditional content block keyed on llms-txt (for example ::: {.content-visible when-format="llms-txt"}) aborts the render with a fatal internal error instead of producing output.
Root cause (confirmed from the filter pipeline):
- Shortcodes are expanded by
pre-shortcodes-filter in the pre phase.
pre-llms-conditional-content runs afterwards, in the same pre phase.
When a ConditionalBlock references llms-txt and its llms visibility differs from its HTML visibility, the handler rebuilds the block from tbl.original_node:clone().
original_node is the snapshot captured at parse time, before shortcode expansion, so the clone re-injects the original unexpanded shortcode into the document after expansion has already run. Nothing expands it again.
- The leftover
Shortcode custom node reaches the post-phase custom-node render, whose render for Shortcode is a placeholder that calls internal_error(), aborting the render.
Source references (permalinks at commit 5748ba2):
|
{ name = "pre-shortcodes-filter", |
|
filter = shortcodes_filter(), |
: pre-shortcodes-filter expands shortcodes.
|
{ name = "pre-llms-conditional-content", |
: pre-llms-conditional-content runs after shortcode expansion.
|
original_node = tbl.node:clone(), -- keep it around in case filters need to inspect it |
: original_node is cloned from the slot at parse time (before expansion).
|
ConditionalBlock = function(tbl) |
|
local llms_visible = is_llms_visible(tbl) |
|
if llms_visible == nil then return nil end |
|
|
|
local html_visible = is_visible(tbl) -- from content-hidden.lua |
|
if llms_visible == html_visible then return nil end -- no intervention needed |
|
|
|
local div = tbl.original_node:clone() |
|
if llms_visible then |
|
div.classes:insert("llms-conditional-content") |
|
else |
|
div.classes:insert("llms-hidden-content") |
|
end |
|
return div |
|
end |
: the handler returns tbl.original_node:clone(), re-injecting the unexpanded content.
|
|
|
render = function(node) |
|
quarto.log.output(node) |
|
-- luacov: disable |
|
internal_error() |
: the Shortcode render placeholder calls internal_error().
Steps to reproduce
_quarto.yml:
project:
type: website
website:
title: "llms-txt repro"
llms-txt: true
format:
html:
toc: true
index.qmd:
---
title: "Home"
---
::: {.content-visible when-format="llms-txt"}
## Conditional Section
{{< lipsum >}}
:::
Render the project:
Actual behavior
The render aborts with a fatal internal error:
{
__quarto_custom_node: Span {
attr: Attr {
attributes: AttributeList {
__quarto_custom: "true"
__quarto_custom_context: "Inline"
__quarto_custom_id: "1"
__quarto_custom_type: "Shortcode"
}
classes: List {}
clone: function: 0xa68c3e730
identifier: ""
}
clone: function: 0xa68c3e4c0
content: Inlines {}
walk: function: 0xa68c3e490
}
name: "lipsum"
params: List {}
t: "Shortcode"
unparsed_content: "{{< lipsum >}}"
}
FATAL (/Users/mcanouil/Projects/quarto-dev/quarto-cli/src/resources/filters/./customnodes/shortcodes.lua:97) An error occurred:
This is an internal error. Please file a bug report at https://github.com/quarto-dev/quarto-cli/
Error running filter /Users/mcanouil/Projects/quarto-dev/quarto-cli/src/resources/filters/main.lua:
...to-dev/quarto-cli/src/resources/filters/./ast/render.lua:53: FATAL QUARTO ERROR
stack traceback:
...to-dev/quarto-cli/src/resources/filters/./common/log.lua:34: in function 'fatal'
...-dev/quarto-cli/src/resources/filters/./common/error.lua:14: in function 'fail'
...-dev/quarto-cli/src/resources/filters/./common/error.lua:19: in function 'internal_error'
...o-cli/src/resources/filters/./customnodes/shortcodes.lua:97: in field 'render'
...to-dev/quarto-cli/src/resources/filters/./ast/render.lua:53: in local 'filter_fn'
...v/quarto-cli/src/resources/filters/./ast/customnodes.lua:168: in function <...v/quarto-cli/src/resources/filters/./ast/customnodes.lua:158>
(...tail calls...)
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:34: in upvalue 'run_filter_function'
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:223: in function <...c/resources/pandoc/datadir/../../filters/modules/jog.lua:202>
(...tail calls...)
[C]: in function 'tmap'
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
... (skipping 5 levels)
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:98: in upvalue 'recurse'
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...c/resources/pandoc/datadir/../../filters/modules/jog.lua:202>
(...tail calls...)
[C]: in function 'tmap'
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:222: in local 'jogger'
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:171: in upvalue 'recurse'
...c/resources/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...c/resources/pandoc/datadir/../../filters/modules/jog.lua:202>
(...tail calls...)
...v/quarto-cli/src/resources/filters/./ast/customnodes.lua:87: in function <...v/quarto-cli/src/resources/filters/./ast/customnodes.lua:65>
(...tail calls...)
.../quarto-cli/src/resources/filters/./ast/runemulation.lua:82: in local 'callback'
.../quarto-cli/src/resources/filters/./ast/runemulation.lua:100: in upvalue 'run_emulated_filter_chain'
.../quarto-cli/src/resources/filters/./ast/runemulation.lua:136: in function <.../quarto-cli/src/resources/filters/./ast/runemulation.lua:133>
WARN: Error encountered when rendering files
ERROR: Error
at renderFiles (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/command/render/render-files.ts:360:11)
at async renderProject (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/command/render/project.ts:439:23)
at async Command.actionHandler (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/command/render/cmd.ts:251:26)
at async Command.execute (https://deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:1948:7)
at async Command.parseCommand (https://deno.land/x/cliffy@v1.0.0-rc.3/command/command.ts:1780:14)
at async quarto (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:198:5)
at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:231:5
at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/core/main.ts:45:14
at async mainRunner (file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/core/main.ts:47:5)
at async file:///Users/mcanouil/Projects/quarto-dev/quarto-cli/src/quarto.ts:221:3
No HTML output is produced.
Expected behavior
The shortcode inside the conditional block is expanded, and the project renders successfully, the
same as when the shortcode sits outside the block or when llms-txt is not enabled.
Your environment
- IDE: VSCode.
- OS: macOS (Darwin 25.5.0).
- Quarto: 99.9.9 (local development build from source, commit
5748ba2).
Quarto check output
Quarto 99.9.9
[✓] Checking environment information...
Quarto cache location: /Users/mcanouil/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.8.3: OK
Dart Sass version 1.87.0: OK
Deno version 2.7.14: OK
Typst version 0.14.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 99.9.9
commit: 5748ba2eb171c4906ce124f5c61c3246045e44a7
Path: /Users/mcanouil/Projects/quarto-dev/quarto-cli/package/dist/bin
[✓] Checking tools....................OK
TinyTeX: v2026.05
Chrome Headless Shell: (not installed)
VeraPDF: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/mcanouil/Library/TinyTeX/bin/universal-darwin
Version: 2026
[✓] Checking Chrome Headless....................OK
Using: Chrome from QUARTO_CHROMIUM
Path: /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
[✓] Checking basic markdown render....OK
(|) Checking R installation...........ℹ R version 4.6.0 (2026-04-24)
! Config '~/.Rprofile' was loaded!
[✓] Checking R installation...........OK
Version: 4.6.0
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.6/Resources/library
knitr: 1.51
rmarkdown: 2.31
[✓] Checking Knitr engine render......OK
[✓] Checking Python 3 installation....OK
Version: 3.14.5
Path: /opt/homebrew/opt/python@3.14/bin/python3.14
Jupyter: (None)
Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter
There is an unactivated Python environment in .venv. Did you forget to activate it?
[✓] Checking Julia installation...
I have
Bug description
Tangentially to #14562, I discovered another issue involving
when-format="llms-txt"and shortcodes resolution.In a website project with
llms-txt: true, placing any shortcode inside a conditional content block keyed onllms-txt(for example::: {.content-visible when-format="llms-txt"}) aborts the render with a fatal internal error instead of producing output.Root cause (confirmed from the filter pipeline):
pre-shortcodes-filterin the pre phase.pre-llms-conditional-contentruns afterwards, in the same pre phase.When a
ConditionalBlockreferencesllms-txtand its llms visibility differs from its HTML visibility, the handler rebuilds the block fromtbl.original_node:clone().original_nodeis the snapshot captured at parse time, before shortcode expansion, so the clone re-injects the original unexpanded shortcode into the document after expansion has already run. Nothing expands it again.Shortcodecustom node reaches the post-phase custom-node render, whoserenderforShortcodeis a placeholder that callsinternal_error(), aborting the render.Source references (permalinks at commit
5748ba2):quarto-cli/src/resources/filters/main.lua
Lines 308 to 309 in 5748ba2
pre-shortcodes-filterexpands shortcodes.quarto-cli/src/resources/filters/main.lua
Line 326 in 5748ba2
pre-llms-conditional-contentruns after shortcode expansion.quarto-cli/src/resources/filters/customnodes/content-hidden.lua
Line 82 in 5748ba2
original_nodeis cloned from the slot at parse time (before expansion).quarto-cli/src/resources/filters/quarto-pre/llms-conditional-content.lua
Lines 40 to 54 in 5748ba2
tbl.original_node:clone(), re-injecting the unexpanded content.quarto-cli/src/resources/filters/customnodes/shortcodes.lua
Lines 93 to 97 in 5748ba2
Shortcoderenderplaceholder callsinternal_error().Steps to reproduce
_quarto.yml:index.qmd:Render the project:
Actual behavior
The render aborts with a fatal internal error:
No HTML output is produced.
Expected behavior
The shortcode inside the conditional block is expanded, and the project renders successfully, the
same as when the shortcode sits outside the block or when
llms-txtis not enabled.Your environment
5748ba2).Quarto check output
Quarto 99.9.9 [✓] Checking environment information... Quarto cache location: /Users/mcanouil/Library/Caches/quarto [✓] Checking versions of quarto binary dependencies... Pandoc version 3.8.3: OK Dart Sass version 1.87.0: OK Deno version 2.7.14: OK Typst version 0.14.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 99.9.9 commit: 5748ba2eb171c4906ce124f5c61c3246045e44a7 Path: /Users/mcanouil/Projects/quarto-dev/quarto-cli/package/dist/bin [✓] Checking tools....................OK TinyTeX: v2026.05 Chrome Headless Shell: (not installed) VeraPDF: (not installed) [✓] Checking LaTeX....................OK Using: TinyTex Path: /Users/mcanouil/Library/TinyTeX/bin/universal-darwin Version: 2026 [✓] Checking Chrome Headless....................OK Using: Chrome from QUARTO_CHROMIUM Path: /Applications/Brave Browser.app/Contents/MacOS/Brave Browser [✓] Checking basic markdown render....OK (|) Checking R installation...........ℹ R version 4.6.0 (2026-04-24) ! Config '~/.Rprofile' was loaded! [✓] Checking R installation...........OK Version: 4.6.0 Path: /Library/Frameworks/R.framework/Resources LibPaths: - /Library/Frameworks/R.framework/Versions/4.6/Resources/library knitr: 1.51 rmarkdown: 2.31 [✓] Checking Knitr engine render......OK [✓] Checking Python 3 installation....OK Version: 3.14.5 Path: /opt/homebrew/opt/python@3.14/bin/python3.14 Jupyter: (None) Jupyter is not available in this Python installation. Install with python3 -m pip install jupyter There is an unactivated Python environment in .venv. Did you forget to activate it? [✓] Checking Julia installation...