When I try to use the chunk toolbar button to "Run all chunks above", I get an error on my first chunk which is css.
That's fair enough since it shouldn't work as executable code,
except it seems like the correct behavior would be to not execute that chunk.
I have tried setting the chunk option "eval=FALSE", but that doesn't change anything, which makes sense since those are knitter options and not IDE execution options.
Is there a way to change this or a good workaround ?
Try placing CSS at top, outside the chunk. Should render as HTML
Thanks for your reply.
I'm not quite sure I understand. It isn't really a question about rendering but about "Run all chunks above" in the IDE.
Is that what you're talking about?
If so, what does it mean to place CSS at top?
You aren’t using Quarto or RMarkdown?
I'm using RMarkdown in RStudio.
Maybe I figured out your point.
To work around the problem css chunk execution,
I removed the css chunk entirely
and put it without a chunk inside a raw style tag
This renders fine on knit, and of course no longer has the execution problem in the RStudio IDE.
1 Like
It should also work outside chunks, along with HTML markup
1 Like
cderv
December 10, 2022, 1:57pm
7
I believe you still encounter this issue
opened 08:52AM - 21 Sep 22 UTC
bug
reproducible
notebook mode
### System details
RStudio Edition : Desktop
RStudio Version : 2022.… 07.0 Build 548
OS Version : Win 10
R Version :
### Steps to reproduce the problem
Consider the following Rmarkdown:
````
---
title: "Non R Chunks Prevent Run All"
output: html_document
editor_options:
chunk_output_type: console
---
```{css css-chunk, echo = FALSE}
.sql {
background-color: #cdd9ef;
}
```
```{r myconsts}
a <- 1
```
```{sql sql-chunk, connection = DBI::dbConnect(RSQLite::SQLite())}
SELECT 1
```
```{r r-chunk}
a + 1
```
````
Now press the `Run all Chunks above` button in the last r chunk:
![image](https://user-images.githubusercontent.com/30824940/191456950-071d57e0-b046-4aad-9431-b2347a6cff2a.png)
### Describe the problem in detail
The first non `R` chunk (i.e. the `CSS` chunk) will (naturally) fail with an error in the console, stopping all the other chunks to run. If I remove the `CSS` chunk, `Run all...` will trip over the `SQL` chunk.
![image](https://user-images.githubusercontent.com/30824940/191458487-a0db34a5-a85a-4998-b290-2f649d0e82d0.png)
### Describe the behavior you expected
I think it is a natural workflow to run the R code in the console once in a while to some quick checks without the need to re-render the whole document. Any non `R` chunk prevents me from using the `Run all Chunks above` button, which is annoying as I have now to run all R chunks manually. I would expect that any non R chunk is excluded from `Run all Chunks above` by default, or at least a chunk option with which I could manually exclude certain chunks from being considered in the `Run all`. Another viable solution would be to be able to tell Rstudio to continue on error nevertheless.
*N.B.* An `eval = FALSE` chunk option allows me to use the `Run all...` button, but then, well, the chunk is not evaluated when rendering. Clearly not what I want.
Interestingly enough, if I decide to output inline,, I can at least run the chunks.
- [x] I have read the guide for [submitting good bug reports](https://github.com/rstudio/rstudio/wiki/Writing-Good-Bug-Reports).
- [ ] I have installed the latest version of RStudio, and confirmed that the issue still persists.
- [ ] If I am reporting an RStudio crash, I have included a [diagnostics report](https://support.rstudio.com/hc/en-us/articles/200321257-Running-a-Diagnostics-Report).
- [x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
or similar in the IDE
Yes - I can also comment there that the css is a problem in 2022.07.2 Build 576
Or I guess it's not necessary as it's reopened and confirmed
1 Like
system
Closed
December 17, 2022, 3:38pm
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.