Title: | 'RStudio' Addins to Simplify 'Markdown' Writing |
Version: | 0.1.0 |
Description: | An 'RStudio' addin providing shortcuts for writing in 'Markdown'. This package provides a series of functions that allow the user to be more efficient when using 'Markdown'. For example, you can select a word, and put it in bold or in italics, or change the alignment of elements inside you Rmd. The idea is to map all the functionalities from 'remedy' on keyboard shortcuts, so that it provides an interface close to what you can find in any other text editor. |
License: | MIT + file LICENSE |
URL: | https://github.com/ThinkR-open/remedy |
BugReports: | https://github.com/ThinkR-open/remedy/issues |
Imports: | knitr, rstudioapi, rematch2, utils, stats |
Suggests: | testthat, rmarkdown |
Encoding: | UTF-8 |
Language: | en-US |
LazyData: | true |
RoxygenNote: | 6.1.0 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2018-11-22 16:23:08 UTC; colin |
Author: | Colin Fay |
Maintainer: | Colin Fay <contact@colinfay.me> |
Repository: | CRAN |
Date/Publication: | 2018-12-03 09:20:03 UTC |
Align a highlighted region's assignment operators.
Description
Align a highlighted region's assignment operators.
Usage
align_arrow()
Value
Aligns the single assignment operators (<-
) within a highlighted region.
Examples
## Not run:
remedy_example(
c( "# Align arrows",
"a <- 12",
"aaa <- 13"),
align_arrow
)
## End(Not run)
Align a highlighted region's assignment operators.
Description
Align a highlighted region's assignment operators.
Usage
align_equal()
Value
Aligns the equal sign assignment operators (=
) within a
highlighted region.
Examples
## Not run:
remedy_example(
c( "# Align equal signs",
"a = 12",
"aaa = 13"),
align_equal
)
## End(Not run)
Backtick
Description
Backtick selected word(s)
Usage
backtickr()
Value
a backticked text selection
Examples
## Not run:
remedy_example(
c( "to_backtick"),
backtickr
)
## End(Not run)
Convert to blockquote
Description
Turn the selected text into a blockquote.
Usage
blockquoter()
Value
a markdown blockquote
Examples
## Not run:
remedy_example(
c( "to_blockquote"),
blockquoter
)
## End(Not run)
Interactively Add Names to Chunks
Description
Addin that add in bulk a names to unnamed chunks in a Rmarkdown document in the source editor.
Usage
chunknamer()
Details
By default the addin will use "remedy" as the stem of the chunk names. this an be changed using
remedy_opts
$set(name='ANOTHER NAME'). The names are then added in sequential order using
an
Interactively Create Rmarkdown Chunks
Description
Addin that splits full documents into Rmarkdown chunks or wraps highlighted text in an active RStudio document editor in a Rmarkdown chunk.
Usage
chunkr()
chunkr_doc()
chunkr_section()
Details
Setting remedy_opts
$set(list(full_doc=TRUE)) chunkr will convert entire document by
remedy_opts
$get('token_purl'). The default token is the output from a purl
conversion (## —-chunk name,chunk options—-).
Setting remedy_opts
$set(list(full_doc=FALSE)), user highlights text and chunkr will
wrap a new Rmarkdown chunk around it, utilizing the other options in remedy_opts
.
Examples
## Not run:
remedy_example(
c( "# Create a chunk",
"a <- 12",
"aaa <- 13"),
chunkr
)
## End(Not run)
Split Chunk
Description
Split a chunk into two chunks
Usage
chunksplitr()
Details
Will split below row of the current cursor position or under the highlighted text.
Footnote
Description
Create a footnote from selected text.
Usage
footnoter()
Value
footnote text (in markdown)
Examples
## Not run:
remedy_example(
c( "# Create a footnote"),
footnoter
)
## End(Not run)
Convert to header
Description
Convert selected text into a header.
Usage
h1r()
h2r()
h3r()
h4r()
h5r()
h6r()
Value
a markdown header
Examples
## Not run:
remedy_example( c( "h1"), h1r)
remedy_example( c( "h2"), h2r)
remedy_example( c( "h3"), h3r)
remedy_example( c( "h4"), h4r)
remedy_example( c( "h5"), h5r)
remedy_example( c( "h6"), h6r)
## End(Not run)
html commenting
Description
RStudio addin to add/remove html comments to highlighted text
Usage
htmlcommentr()
Details
Highlighting text will add html comment tags around it
Highlighting commented text will remove tags.
Highlighting
Something COMMENT Something
Something <!– COMMENT –> Something
New Comment
Something COMMENT [cursor here] Something
Something COMMENT <!– –> Something
Start of Row
[cursor here] Something COMMENT Something
<!– Something COMMENT Something –>
Highlighting Multiple rows
Something COMMENT Something
Something COMMENT Something
<!– Something COMMENT Something
Something COMMENT Something –>
Examples
## Not run:
remedy_example( c( "<b>This is bold</b>"), htmlcommentr)
## End(Not run)
Imager
Description
Convert the selected path into an embedded image
Usage
imager()
Value
a markdown image link
Examples
## Not run:
remedy_example(
c( "https://thinkr.fr/wp-content/uploads/2015/03/thinkR1.png"),
imager
)
## End(Not run)
Check if text is a relative link or URL
Description
Check if text is a relative link or URL
Usage
is_link(text)
Arguments
text |
A character string |
Value
TRUE or FALSE
Examples
is_link("www.google.com")
is_link("figs/plot.png")
Emphasize
Description
Emphasize the selected text.
Usage
italicsr()
boldr()
striker()
Value
emboldened, italicized or strikethrough text (in markdown)
Examples
## Not run:
remedy_example(
c( "to_italic"),
italicsr
)
remedy_example(
c( "to_bold"),
boldr
)
remedy_example(
c( "to_strike"),
striker
)
## End(Not run)
LaTeX
Description
Convert the selected text in inline LaTeX.
Usage
latexr()
Value
inline LaTeX text (in markdown)
Examples
## Not run:
remedy_example(
c( "Latex stuffs"),
latexr
)
## End(Not run)
Convert to list
Description
Convert selected text into an (un)ordered list.
Usage
listr()
olistr()
Value
listr()
returns an unordered markdown list
olistr()
returns an ordered markdown list
Examples
## Not run:
#unordered list
remedy_example(c('line 1','line 2'),listr)
#ordered list
remedy_example(c('line 1','line 2'),olistr)
## End(Not run)
Functions to run examples and tests
Description
Utility functions to deploy functions and tests for addins
Usage
remedy_example(txt, addin, mark = entire_document)
scratch_file()
entire_document()
individual_lines()
set_text(txt = "", sec, mark)
Arguments
txt |
character, text to place in temporary document |
addin |
function, addin function to deploy |
mark |
function, highlight using entire_document or individual_lines |
sec |
source editor context object |
Details
These function only will work in a RStudio IDE
Value
New document in source editor of RStudio
Default and current remedy options
Description
Options for functions in the remedy package. When running R code, the object remedy_opts
(default options) is not modified by chunk headers (local chunk options are
merged with default options), whereas remedy_opts_current
(current options)
changes with different chunk headers and it always reflects the options for
the current chunk.
Normally we set up the global options once in the first code chunk in a
document using remedy_opts$set()
, so that all latter chunks will
use these options. Note the global options set in one chunk will not affect
the options in this chunk itself, and that is why we often need to set global
options in a separate chunk.
Below is a list of default chunk options, retrieved via
remedy_opts$get()
:
Usage
remedy_opts
remedy_opts_current
Format
An object of class list
of length 5.
Note
remedy_opts_current
is read-only in the sense that it does nothing if
you call remedy_opts_current$set()
; you can only query the options via
remedy_opts_current$get()
.
Examples
remedy_opts$get()
Mover
Description
Copy a selected text or the current line to the right
Usage
rightr()
Value
a clone of the line
Examples
## Not run:
remedy_example(
c( "I like to move it "),
rightr
)
## End(Not run)
Tabler
Description
Insert a table in your file.
Usage
tabler()
Value
a markdown table
Examples
## Not run:
remedy_example(
"head(iris)",
tabler
)
## End(Not run)
urlr
Description
Convert selected text into a link
Usage
urlr()
Value
a markdown link
Examples
## Not run:
remedy_example(
"https://www.thinkr.fr",
urlr
)
## End(Not run)
xaringan
Description
xaringan pull left and pull right
Usage
xaringanr()
Value
a template for xaringan pull left and right
Examples
## Not run:
remedy_example(
"",
xaringanr
)
## End(Not run)
Addin to create markdown youtube links
Description
Highlight youtube link in source editor and it will be converted to a markdown link with an image saved in youtube.
Usage
youtuber()
Details
if remedy_opts$get('youtube_output')=='md' then the output will be of the form
[](Link to Video). (useful for github readme)
if remedy_opts$get('youtube_output')=='html' then the output will be of the form
<iframe width="remedy_opts$get('youtube_width')" height="remedy_opts$get('youtube_height')" src="link to video" frameborder="0" allowfullscreen></iframe>
Default Settings:
remedy_opts$get('youtube_output'): str(remedy::remedy_opts$get('youtube_output'))
remedy_opts$get('youtube_height'): str(remedy::remedy_opts$get('youtube_height'))
remedy_opts$get('youtube_width'): str(remedy::remedy_opts$get('youtube_width'))
Examples
## Not run:
remedy_example(
"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
youtuber
)
## End(Not run)