Skip to content

Include no or only one blank line between the in-body syntax and code in R knitr chunks #1069

@IndrajeetPatil

Description

@IndrajeetPatil

Description

Having a single blank line between the chunk options and the chunk code helps visually distinguish them. But having more than one blank line is (IMO) rarely desirable. It would be good if {styler} could do this.

As for when there is no blank line, I am not sure if we should introduce one because the user intent is more likely to not have any separation between the options and the code.

This issue applies equally to .Rmd/.qmd docs.

Example-1

1 blank line

before

```{r}
#| label = "my_chunk",
#| fig.height = 6,




# code
x <- 1 
```

after

```{r}
#| label = "my_chunk",
#| fig.height = 6,

# code
x <- 1 
```

Example-2

0 blank lines (unsure, but my current preference)

before

```{r}
#| label = "my_chunk",
#| fig.height = 6,
# code
x <- 1 
```

after

```{r}
#| label = "my_chunk",
#| fig.height = 6,
# code
x <- 1 
```

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions