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

collapse is not working since 1.46 #2346

Closed
cderv opened this issue May 30, 2024 · 2 comments · Fixed by #2347
Closed

collapse is not working since 1.46 #2346

cderv opened this issue May 30, 2024 · 2 comments · Fixed by #2347
Labels
bug Bugs

Comments

@cderv
Copy link
Collaborator

cderv commented May 30, 2024

It seems we missed a breakage in 1.46 release

With knitr 1.46

> xfun::raw_string(knitr::knit(text = c("```{r, collapse=TRUE}\n1 + 1\n1:1\n```")))
                                                                                                                                                                

``` r
1 + 1
## [1] 2
```

``` r
1:1
## [1] 1
```

With knitr 1.45

> xfun::raw_string(knitr::knit(text = c("```{r, collapse=TRUE}\n1 + 1\n1:1\n```")))
                                                                                                                                                                

```r
1 + 1
## [1] 2
1:1
## [1] 1
```

This was found at reprex side

@cderv cderv added the bug Bugs label May 30, 2024
@cderv
Copy link
Collaborator Author

cderv commented May 30, 2024

A quick bisect shows that 5435c52 was the commit that broke

This is when we moved to xfun::fenced_block(). When there is only one class (the language), we now have a space and the regex does not handle it

Note that using several classes or attributes works as we create the other syntax

> xfun::raw_string(knitr::knit(text = c("```{r, collapse=TRUE, class.source='b'}\n1 + 1\n1:1\n```")))
                                                                                                                                                                

```{.r .b}
1 + 1
## [1] 2
1:1
## [1] 1
```

> xfun::raw_string(knitr::knit(text = c("```{r, collapse=TRUE, attr.source='b=true'}\n1 + 1\n1:1\n```")))
                                                                                                                                                                

```{.r b=true}
1 + 1
## [1] 2
1:1
## [1] 1
```

Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs
Projects
None yet
1 participant