Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
IndrajeetPatil opened this issue Nov 24, 2022 · 2 comments

Comments

@IndrajeetPatil
Copy link
Collaborator

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 
```
@lorenzwalthert
Copy link
Collaborator

Happy to keep at most one. Potential interaction with #1056, so let's wait until we figured that one out.

@lorenzwalthert
Copy link
Collaborator

#1056 is no longer blocking this, if anyone wants to have a go with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants