quarto-dev / quarto-dev/quarto-cli

knitr params in standalone YAML block don't work

Open
#7,785 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug engines-knitr
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

This doesn't work:

---
title: "test"
format: html
---

---
params:
  p1: 1.0
  p2: "A"
  p3: TRUE
---

# Test 

```{r}
print(params$p1)
print(params$p2)
print(params$p3)
```

But this does work:

---
title: "test"
format: html
params:
  p1: 1.0
  p2: "A"
  p3: TRUE
---

# Test 

```{r}
print(params$p1)
print(params$p2)
print(params$p3)
```

I can confirm that the input file sent to knitr has the params block.

@cderv Is this a knitr bug?

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

Start with the minimal Quarto document in the issue and compare the standalone YAML block with the working front-matter form. Trace how Quarto passes metadata to knitr, then verify that parameters from the standalone block are available to the R code and that the existing working form remains unchanged.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.