R won't run when in Quarto

I have the exact same problem as related here: RStudio won't run code in Quarto document - RStudio IDE - Posit Community

It seem to have started after I used the shortcut to insert code block (I was using source mode, not visual mode).

This happens to me in Positron when I do not leave any spaces between a text (or a previous code block) and a new code block. Each code block needs to have space before and after it, like:

  • Example of wrong :prohibited: (code won't run fully):

Blablabla this is a text blabla.
```{r}
head(mtcars)
```

  • And this is how you'd fix it:

Blablabla this is a text blabla.

```{r}
head(mtcars)
```

It can happen also when the text is below the code block.

I hope it works!