Skip to content

include does not inject code into a non-executable block #1237

@aronatkins

Description

@aronatkins

Bug description

Using Quarto 0.9.607 (contained in a recent RStudio build -- 2022.10.0 Build 9), but have also tested Quarto 0.9.629. The same rendered results occur with both versions, and within and outside the RStudio IDE.

Observed on macOS Monterey - 12.4

Given index.qmd defined as:

---
title: embedding code using includes
---

## in a code block

The `cats.R` file should be injected into the R code block and correctly 
formatted without being executed.

```r
{{< include cats.R >}}
```

## outside a code block

Here is an example showing how the R code can be injected, but it does not
have the desired code-block styling.

{{< include cats.R >}}

## expected

This is the expected result when formatted:

```r
cat("cats!\n")
```

and a cats.R file defined as:

cat("cats!\n")

The rendering should present the code from cats.R as formatted R code in the first code block (containing the include).

Instead, the rendered result has an empty code block and looks like:

image

Checklist

  • formatted your issue so it is easier for us to read?
  • included a minimal, self-contained, and reproducible example?
  • documented the quarto version you're running, by providing the output produced by quarto check in a terminal in your issue?
  • documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • documented which operating system you're running? If on Linux, please provide the specific distribution as well.
  • upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions