{remedy} is now on CRAN

After living for more than a year on GitHub, we are pleased to announce that the {remedy} package is now on CRAN. 

A package for easier Markdown writing

About {remedy}

Have you ever been frustrated about having to manually add markdown tags to your Rmd? If you are an avid markdown user, no doubt you’ve been complaining about what should be an easy task: adding bold, creating lists, urls, italics…

Good news, we’ve got the cure! {remedy} is a package designed to facilitate writing markdown documents in RStudio. The idea is to provide a series of keyboard shortcuts that will make you more efficient with markdown.

In other words, this package brings to markdown a “word processor like” experience when it comes to formatting — that is to say that putting things in bold is now possible via a keyboard shortcut.

Here is a quick example:

Available shorcuts

Here is a list of available shortcuts:

  • align_arrow / align_equal align the assignment operators in the highlighted text.
  • backtickr takes a piece of text an put it between backticks.
  • boldr / italicsr / striker put a piece of text in bold, italics, or strike.
  • chunkr / chunknamer / chunkr_doc / chunkr_section / chunksplitr, addins to deal with chunks.
  • footnoter creates a footnote.
  • h1r:h6r set selected text to headers (from H1 to H6).
  • htmlcommentr add comment tags.
  • imager / urlr / youtuber take an url and set the appropriate html/markdown tags.
  • latexr add LaTeX tags.
  • listr / olistr turn a series of lines into lists.
  • rightr copies selected content to the right.
  • tabler generates a markdown table.
  • xaringanr inserts a pull-left pull-right for {xaringan}.

Setting up

Installing

You can install {remedy} from the CRAN or from GitHub:

# From CRAN
install.packages("remedy")
# From GitHub
remotes::install_github("ThinkR-open/remedy")

Note that once installed, you don’t need to launch the package to use the shortcuts.

Keyboard shortcuts

Of course, the idea is not to select the text, go to your addins list, search for the good addin, and to do perform the transformation: you need to bind the content of {remedy} to keyboard shortcuts.

If ever you want to do that, you can do this manually through Tools > Modify Keyboard Shortcuts.

You can also use the {rsam} package — either with the recommended shortcuts:

remedy::remedy_opts$get('hotkeys')
#>           backtick               bold              chunk 
#>       "Ctrl+Cmd+`"       "Ctrl+Cmd+B"   "Ctrl+Alt+Cmd+C" 
#>         chunksplit          chunkname           footnote 
#> "Ctrl+Shift+Alt+C" "Ctrl+Shift+Alt+N" "Ctrl+Cmd+Shift+6" 
#>                 h1                 h2                 h3 
#>       "Ctrl+Cmd+1"       "Ctrl+Cmd+2"       "Ctrl+Cmd+3" 
#>                 h4                 h5                 h6 
#>       "Ctrl+Cmd+4"       "Ctrl+Cmd+5"       "Ctrl+Cmd+6" 
#>        htmlcomment              image            italics 
#>       "Ctrl+Alt+C"       "Ctrl+Cmd+P"       "Ctrl+Cmd+I" 
#>              latex               list              right 
#>       "Ctrl+Cmd+L" "Ctrl+Shift+Cmd+="    "Alt+Cmd+Right" 
#>             strike              table                url 
#>       "Ctrl+Cmd+S"       "Ctrl+Cmd+T"       "Ctrl+Cmd+U" 
#>           xaringan            youtube 
#>       "Ctrl+Cmd+X"       "Ctrl+Cmd+Y"

hotkeys <- remedy::remedy_opts$get("hotkeys")
rsam::set_shortcut(sprintf('remedy::%sr',names(hotkeys)), hotkeys)

or with your own shortcuts.

Feedback and enhancement

You’ve found a bug, or have an enhancement idea? Feel free to open an
issue : https://github.com/ThinkR-open/remedy/issues.

Author Profile

Colin Fay
Colin FayData Scientist and R Hacker
Data Scientist and R Hacker