Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tjmahr/wraprmd
RStudio addin for wrapping RMarkdown paragraphs
https://github.com/tjmahr/wraprmd
knitr r rmarkdown rstudio
Last synced: about 1 month ago
JSON representation
RStudio addin for wrapping RMarkdown paragraphs
- Host: GitHub
- URL: https://github.com/tjmahr/wraprmd
- Owner: tjmahr
- License: other
- Created: 2016-03-03T19:56:57.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-02-19T18:27:19.000Z (10 months ago)
- Last Synced: 2024-08-06T03:05:00.862Z (5 months ago)
- Topics: knitr, r, rmarkdown, rstudio
- Language: R
- Homepage:
- Size: 82 KB
- Stars: 102
- Watchers: 4
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WrapRmd
An [RStudio Addin](https://rstudio.github.io/rstudioaddins/) to wrap paragraphs
of RMarkdown text without inserting line breaks into inline R code.## Installation
You can install the plain version WrapRmd from GitHub with:
``` r
# install.packages("devtools")
devtools::install_github("tjmahr/WrapRmd")
```This package used the
[commonmark](https://cran.r-project.org/web/packages/commonmark/index.html)
package to wrap and reformat to markdown text. Using commonmark means that it
can wrap links and markdown lists. The package does some additional work to
handle inline R Markdown.## Overview
Here is some nice looking RMarkdown:
```
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum a `r max(iris$Sepal.Length)`, viverra nisl at, luctus ante = `r length(letters) * 2 + 100`.
```You highlight the text, and hit `Ctrl/Cmd + Shift + /` to wrap the text and get:
```
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum a `r
max(iris$Sepal.Length)`, viverra nisl at, luctus ante = `r length(letters) * 2 +
100`.
```This RStudio Addin wraps text, but doesn't insert line breaks into inline R
code, yielding:```
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum
a `r max(iris$Sepal.Length)`, viverra nisl at, luctus ante =
`r length(letters) * 2 + 100`.
```![An animation of the above](demo.gif)
## Notes
Then go to Tools > Addins in RStudio to select and configure addins. I've mapped
this one addin to the shortcut `Ctrl + Shift + Alt + /`.The package wraps lines using a maximum width set by `options("WrapRmd.width")`
which currently defaults to `80` characters.It should work on multiple paragraphs:
![Animation of wrapping paragraphs separately](multi_paragraph.gif)