quarto-dev / quarto-dev/quarto-cli

Quarto render with --execute-params only updates executable code but not shortcode

Open
#11,167 19 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs-design parameters
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

Given a main qmd document test.qmd, when specifying the params externally in a params.yml file and trying the quarto render test.qmd --execute-params params.yaml the parameters are only updated in the portion of executable code (e.g. those included within an R chunk), but not for the shortcodes. Is this an intentional behaviour?

Steps to reproduce

test.qmd


---
title: "Conditional content with params"
format: html 
editor: visual
params:
  print: FALSE
---

::: {.content-hidden unless-meta="params.print"}
If PRINT parameter is TRUE, we'll show this.

shortcode shows PRINT = {{< meta params.print >}}

```{r, echo=FALSE}
cat("executed code shows PRINT = ", params$print)
if(params$print){
  cat("Hello World")
} else {
  cat("Not printing anything, because params$print is FALSE")
}
```
:::

::: {.content-hidden when-meta="params.print"}
If PRINT parameter is FALSE, we'll show this instead.

shortcode shows PRINT = {{< meta params.print >}}

```{r, echo=FALSE}
cat("executed code shows PRINT = ", params$print)
if(params$print){
  cat("Hello World")
} else {
  cat("Not printing anything, because params$print is FALSE")
}
```
:::

params.yml

print: FALSE
Expected behavior
Conditional content with params

If PRINT parameter is FALSE, we’ll show this instead.

shortcode shows PRINT = false

executed code shows PRINT = FALSE

Not printing anything, because params$print is FALSE

Actual behavior
Conditional content with params

If PRINT parameter is FALSE, we'll show this.

shortcode shows PRINT = true

executed code shows PRINT = FALSE

Not printing anything, because params$print is FALSE

Your environment
  • IDE: Rstudio 2024.04.2+764
  • OS: Windows 10 22H2
Quarto check output

Quarto 1.4.555
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.4.555
CodePage: 1252

[>] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)

[>] Checking LaTeX....................OK
Tex: (not detected)

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
Version: 3.11.2
Jupyter: 5.2.0
Kernels: python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
Version: 4.4.1
knitr: 1.48
rmarkdown: 2.28

[>] Checking Knitr engine render......OK

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with quarto render test.qmd --execute-params params.yaml, using the supplied test.qmd and params.yml. Trace how external execution parameters reach executable R code versus the {{< meta params.print >}} shortcode. Done means both the shortcode and executable code reflect the externally supplied value, with regression coverage for the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.