Skip to content

Commit e24bcbd

Browse files
authored
Fix original.code attribute leaking into every chunk's .cell div (#14928)
knitr's dev branch (yihui/knitr#2521, merged 2026-09-21) now stashes params$original.code (the raw fenced chunk source) into every chunk's quarto_options attribute bundle, alongside original.params.src, chunk.echo, and yaml.code. Those three were already allowlisted in hooks.R's other_opts; original.code was not, so hooks.R's generic unknown-attribute forwarder picks it up and writes it as a literal Pandoc div attribute on every chunk's .cell div, not just echo:fenced ones. test-smokes.yml installs dev knitr from r-universe on every CI run, so this started failing docs/smoke-all/knitr/execution-env-var.qmd the same day #2521 merged: the leaked original.code happened to contain the literal string UNDEFINED, tripping that test's regex assertion even though the env vars under test were resolving correctly. Add original.code to other_opts next to original.params.src so it is consumed rather than forwarded, matching the other three bundle fields.
1 parent 19a7da9 commit e24bcbd

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎src/resources/rmd/hooks.R‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ knitr_hooks <- function(format, resourceDir, handledLanguages) {
363363
# fmt: skip
364364
other_opts <- c(
365365
"eval", "yaml.code", "code", "file", "params.src", "original.params.src",
366+
"original.code",
366367
"fenced.echo", "chunk.echo", "lang", "out.width.px", "out.height.px",
367368
"indent", "class.source", "class.output", "class.message",
368369
"class.warning", "class.error", "attr.source", "attr.output",

0 commit comments

Comments
 (0)