WrapRmd
WrapRmd copied to clipboard
Ignore code blocks and yaml
It seems that code blocks and yaml are being wrapped, for instance:
```{r}
layout(
subplot(p2),
yaxis2 = list(title = ""),
yaxis3 = list(title = "")
)
```
becomes
```{r} layout( subplot(p2), yaxis2 = list(title = ""), yaxis3 = list(title =
"") ) ```
Would it be possible to ignore code chunks and yaml?
That might be difficult to do correctly and comprehensively, like requiring a detailed parsing of the selected text. I could try some heuristics, such as not wrapping anything within a fenced code block.
I would appreciate this as well. My use case here is formatting an entire inherited .Rmd
with chaotic line breaks via Ctrl + A
>> Ctrl + Shift + Alt + /
, but this currently breaks YAML headers.
Setting this help wanted. For whole document transformation, we probably need to send the text to pandoc for parsing, traverse the tree to escape to `r code`
bits, get the wrapped output and unescape it.
As a fix: Does switching to the visual editor, have it use column-based line-wrapping, and switching back to text editor solve it?