├── .Rbuildignore
├── .github
├── ISSUE_TEMPLATE
│ ├── Bug_report.md
│ └── Feature_request.md
├── PULL_REQUEST_TEMPLATE.md
└── stale.yml
├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CONDUCT.md
├── DESCRIPTION
├── LICENSE
├── NAMESPACE
├── NEWS.md
├── R
├── align.R
├── backtickr.R
├── blockquoter.R
├── chunknamer.R
├── chunkr.R
├── chunksplitr.R
├── emphasize.R
├── example_utils.R
├── footnoter.R
├── headr.R
├── htmlcommentr.R
├── imager.R
├── internal.R
├── latexr.R
├── listr.R
├── mover.R
├── opts.R
├── opts_complete.R
├── referr.R
├── remedy-package.R
├── tabler.R
├── urlr.R
├── utils.R
├── xaringan.R
└── youtuber.R
├── README.Rmd
├── README.md
├── _pkgdown.yml
├── codecov.yml
├── contributing.md
├── data-raw
└── devtools.R
├── inst
└── rstudio
│ └── addins.dcf
├── man
├── align_arrow.Rd
├── align_equal.Rd
├── backtickr.Rd
├── blockquoter.Rd
├── chunknamer.Rd
├── chunkr.Rd
├── chunksplitr.Rd
├── emphasize.Rd
├── footnote.Rd
├── header.Rd
├── htmlcommentr.Rd
├── imager.Rd
├── is_link.Rd
├── latex.Rd
├── listr.Rd
├── move.Rd
├── ref.Rd
├── remedy-package.Rd
├── remedyOpts.Rd
├── remedy_example.Rd
├── tabler.Rd
├── urlr.Rd
├── xaringanr.Rd
└── youtuber.Rd
├── reference
└── figures
│ ├── align.gif
│ ├── alignequal.gif
│ ├── backtick.gif
│ ├── blockquote.gif
│ ├── chunck.gif
│ ├── chunk.gif
│ ├── chunksplit.gif
│ ├── cross-ref.gif
│ ├── down.gif
│ ├── emphasise.gif
│ ├── footnote.gif
│ ├── header.gif
│ ├── htmlcomment.gif
│ ├── image.gif
│ ├── latex.gif
│ ├── list.gif
│ ├── remedy_example.gif
│ ├── right.gif
│ ├── table.gif
│ ├── table_remedy.gif
│ ├── thinkr-hex-remedy-favicon.ico
│ ├── thinkr-hex-remedy-small.png
│ ├── thinkr-hex-remedy.png
│ ├── url.gif
│ ├── xaringan.gif
│ └── youtube.gif
├── remedy.Rproj
├── tests
├── README.md
├── testthat.R
└── testthat
│ ├── helper-functions.R
│ ├── test-backtick.R
│ ├── test-blockquote.R
│ ├── test-chunk.R
│ ├── test-chunknamer.R
│ ├── test-emphasizers.R
│ ├── test-enclose.R
│ ├── test-footnote.R
│ ├── test-headr.R
│ ├── test-image.R
│ ├── test-latex.R
│ ├── test-link.R
│ ├── test-list.R
│ ├── test-multiline_prefix.R
│ ├── test-prefix.R
│ ├── test-right.R
│ ├── test-url.R
│ ├── test-xaringan.R
│ └── test-youtube.R
└── vignettes
├── .gitignore
└── tests_and_coverage.Rmd
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^CODE_OF_CONDUCT\.md$
2 | ^images$
3 | ^Meta$
4 | ^doc$
5 | ^README\.md$
6 | ^.*\.Rproj$
7 | ^\.Rproj\.user$
8 | ^data-raw$
9 | ^CONDUCT\.md$
10 | ^README\.Rmd$
11 | ^README-.*\.png$
12 | readme_gif
13 | ^\.travis\.yml$
14 | ^codecov\.yml$
15 | .github
16 | ^_pkgdown\.yml$
17 | ^docs$
18 | ^reference$
19 | ^contributing\.md$
20 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/Bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | ---
5 |
6 | **Describe the bug**
7 |
8 | A clear and concise description of what the bug is.
9 |
10 | **To Reproduce**
11 |
12 | Steps to reproduce the behavior:
13 |
14 | **Expected behavior**
15 |
16 | A clear and concise description of what you expected to happen.
17 |
18 | **Environment (please complete the following information):**
19 |
20 |
21 | Session Info
22 |
23 | ```r
24 | # paste here the output of devtools::session_info()
25 |
26 |
27 | ```
28 |
29 |
30 |
31 | **Additional context**
32 | Add any other context about the problem here.
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/Feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | ---
5 |
6 | **Is your feature request related to a problem? Please describe.**
7 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
8 |
9 | **Describe the solution you'd like**
10 | A clear and concise description of what you want to happen.
11 |
12 | **Describe alternatives you've considered**
13 | A clear and concise description of any alternative solutions or features you've considered.
14 |
15 | **Additional context**
16 | Add any other context or screenshots about the feature request here.
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # Number of days of inactivity before an issue becomes stale
2 | daysUntilStale: 60
3 | # Number of days of inactivity before a stale issue is closed
4 | daysUntilClose: 7
5 | # Issues with these labels will never be considered stale
6 | exemptLabels:
7 | - pinned
8 | - security
9 | # Label to use when marking an issue as stale
10 | staleLabel: wontfix
11 | # Comment to post when marking an issue as stale. Set to `false` to disable
12 | markComment: >
13 | This issue has been automatically marked as stale because it has not had
14 | recent activity. It will be closed if no further activity occurs. Thank you
15 | for your contributions.
16 | # Comment to post when closing a stale issue. Set to `false` to disable
17 | closeComment: false
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | Meta
2 | doc
3 | .Rproj.user
4 | .Rhistory
5 | .RData
6 | .Ruserdata
7 | inst/doc
8 | docs
9 | man/figures/*
10 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
2 | language: R
3 | sudo: false
4 | cache: packages
5 |
6 | r_github_packages:
7 | - ThinkR-open/remedy # pre-install to avoid vignette package errors
8 | - yonicd/covrpage
9 |
10 | # build matrix; turn on vdiffr only on r release
11 | matrix:
12 | include:
13 | - r: devel
14 | - r: release
15 | env: VDIFFR_RUN_TESTS=true
16 | before_cache:
17 | - Rscript -e 'remotes::install_cran("pkgdown")'
18 | - Rscript -e 'remotes::install_github("ThinkR-open/thinkrtemplate")'
19 | deploy:
20 | provider: pages
21 | skip-cleanup: true
22 | github-token: $GITHUB_PAT
23 | keep-history: true
24 | local-dir: docs
25 | on:
26 | branch: master
27 | skip_cleanup: true
28 | - r: oldrel
29 |
30 | before_install:
31 | - Rscript -e 'update.packages(ask = FALSE)'
32 |
33 | after_success:
34 | - Rscript -e 'devtools::test()'
35 | - Rscript -e 'covr::codecov()'
36 | - Rscript -e 'install.packages("devtools")'
37 | - Rscript -e 'devtools::install(); covrpage::covrpage_ci()'
38 | - Rscript -e 'pkgdown::build_site()'
39 |
40 | env:
41 | global:
42 | secure: XD+r1YkimwwxPC+Vsh4rRIHxnDOF+KLSYgsw7C7YhCbZbfc/cMUj0/uwc1+AOg/DEBPMq4mt6TPqNsfThKCFTxGdCV2f06dcehHq+s2JYnNEH90io3JqftvF6vc14iUSBR896WNY3/a7+GmVrK/PatbMzJOV8k5t4TZqrRenEbjnV5bPO+kbWjFy0CXi79bJzF8+ov6xvfLO+npYnD+zELQ2ZH+ewxy2HvOreQGqFXsS3NmJDEmriGDnDbNvS5Y0nQc16zm+v+Y/G4uAJzNBBKTZIcDzjGsOTs6pAenLVRt4lYfmhXVFAQU490rYQ8kKLYh21G5lgsdxNGsMqx4L3vCGU47ZNlq0+oPWFkrn2/LcC19bNTmYT+yolM7bSsSFKP6QnjnEKp+fCS1kGS3A8qgl59n3bGShmCfastYmGk/Wox9e8dVPxwJo3JZNh0IL6485OyTgoxS9mAmPu/hv8DksVh26IqrKjPc1VhG7Lms25rphBD5qUrzPb0JGwh2rnU2ryMUUQpn5Nt9FwlwHKe0E51NPUzI8PIle1gmsTNjIizd8vVfoKOpU6aQ060McnlEADLpPCCsD8opAixymkOZSxUovDMKEz7kSDPygWPZrJ70gc/c2Srnp2V5rFcqP8isk6qpigJRnYCZTl7Dsc5VFOf/Q3F2bs7DQcZKp4zA=
43 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project, we pledge to respect all people who
4 | contribute through reporting issues, posting feature requests, updating documentation,
5 | submitting pull requests or patches, and other activities.
6 |
7 | We are committed to making participation in this project a harassment-free experience for
8 | everyone, regardless of level of experience, gender, gender identity and expression,
9 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
10 |
11 | Examples of unacceptable behavior by participants include the use of sexual language or
12 | imagery, derogatory comments or personal attacks, trolling, public or private harassment,
13 | insults, or other unprofessional conduct.
14 |
15 | Project maintainers have the right and responsibility to remove, edit, or reject comments,
16 | commits, code, wiki edits, issues, and other contributions that are not aligned to this
17 | Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
18 | from the project team.
19 |
20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
21 | opening an issue or contacting one or more of the project maintainers.
22 |
23 | This Code of Conduct is adapted from the Contributor Covenant
24 | (http://contributor-covenant.org), version 1.0.0, available at
25 | http://contributor-covenant.org/version/1/0/0/
26 |
--------------------------------------------------------------------------------
/CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project, we pledge to respect all people who
4 | contribute through reporting issues, posting feature requests, updating documentation,
5 | submitting pull requests or patches, and other activities.
6 |
7 | We are committed to making participation in this project a harassment-free experience for
8 | everyone, regardless of level of experience, gender, gender identity and expression,
9 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
10 |
11 | Examples of unacceptable behavior by participants include the use of sexual language or
12 | imagery, derogatory comments or personal attacks, trolling, public or private harassment,
13 | insults, or other unprofessional conduct.
14 |
15 | Project maintainers have the right and responsibility to remove, edit, or reject comments,
16 | commits, code, wiki edits, issues, and other contributions that are not aligned to this
17 | Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
18 | from the project team.
19 |
20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
21 | opening an issue or contacting one or more of the project maintainers.
22 |
23 | This Code of Conduct is adapted from the Contributor Covenant
24 | (http:contributor-covenant.org), version 1.0.0, available at
25 | http://contributor-covenant.org/version/1/0/0/
26 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: remedy
2 | Title: 'RStudio' Addins to Simplify 'Markdown' Writing
3 | Version: 0.1.1
4 | Authors@R: c(person("Colin", "Fay", email = "contact@colinfay.me", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7343-1846")),
5 | person("Jonathan", "Sidi", email = "yonicd@gmail.com", role = c("aut"), comment = c(ORCID = "0000-0002-4222-1819")),
6 | person("Luke", "Smith", email = "luke@protocolvital.info", role = c("aut"), comment = "author of seasmith/AlignAssign"),
7 | person("Jonathan", "Carroll", email = "rpkg@jcarroll.com.au", role = c("ctb"), comment = c(ORCID = "0000-0002-1404-5264")),
8 | person("Andrzej", "Oleś", email = "andrzej.oles@gmail.com", role = c("ctb"), comment = c(ORCID = "0000-0003-0285-2787")),
9 | person("Daniel", "Possenriede", email = "possenriede@gmail.com", role = c("ctb"), comment = c(ORCID = "0000-0002-6738-9845")),
10 | person(given = "ThinkR", role = "cph"))
11 | Description: An 'RStudio' addin providing shortcuts for writing in 'Markdown'. This package provides a series of
12 | functions that allow the user to be more efficient when using 'Markdown'. For example, you can select
13 | a word, and put it in bold or in italics, or change the alignment of elements inside you Rmd. The idea
14 | is to map all the functionalities from 'remedy' on keyboard shortcuts, so that it provides an interface
15 | close to what you can find in any other text editor.
16 | License: MIT + file LICENSE
17 | URL: https://github.com/ThinkR-open/remedy
18 | BugReports: https://github.com/ThinkR-open/remedy/issues
19 | Imports:
20 | knitr,
21 | rstudioapi,
22 | rematch2,
23 | utils,
24 | stats
25 | Suggests:
26 | testthat,
27 | rmarkdown
28 | Encoding: UTF-8
29 | Language: en-US
30 | LazyData: true
31 | RoxygenNote: 7.1.0
32 | VignetteBuilder: knitr
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2017
2 | COPYRIGHT HOLDER: Colin Fay
3 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | export(align_arrow)
4 | export(align_equal)
5 | export(backtickr)
6 | export(blockquoter)
7 | export(boldr)
8 | export(chunknamer)
9 | export(chunkr)
10 | export(chunksplitr)
11 | export(entire_document)
12 | export(footnoter)
13 | export(h1r)
14 | export(h2r)
15 | export(h3r)
16 | export(h4r)
17 | export(h5r)
18 | export(h6r)
19 | export(htmlcommentr)
20 | export(id_ref)
21 | export(imager)
22 | export(individual_lines)
23 | export(is_link)
24 | export(italicsr)
25 | export(latexr)
26 | export(listr)
27 | export(olistr)
28 | export(remedy_example)
29 | export(remedy_opts)
30 | export(remedy_opts_current)
31 | export(rightr)
32 | export(scratch_file)
33 | export(set_text)
34 | export(striker)
35 | export(tabler)
36 | export(urlr)
37 | export(xaringanr)
38 | export(youtuber)
39 | importFrom(knitr,kable)
40 | importFrom(rematch2,re_match)
41 | importFrom(rstudioapi,documentSave)
42 | importFrom(rstudioapi,document_position)
43 | importFrom(rstudioapi,document_range)
44 | importFrom(rstudioapi,getActiveDocumentContext)
45 | importFrom(rstudioapi,getSourceEditorContext)
46 | importFrom(rstudioapi,insertText)
47 | importFrom(rstudioapi,isAvailable)
48 | importFrom(rstudioapi,modifyRange)
49 | importFrom(rstudioapi,navigateToFile)
50 | importFrom(rstudioapi,setCursorPosition)
51 | importFrom(rstudioapi,setSelectionRanges)
52 | importFrom(rstudioapi,showDialog)
53 | importFrom(utils,modifyList)
54 | importFrom(utils,rc.options)
55 |
--------------------------------------------------------------------------------
/NEWS.md:
--------------------------------------------------------------------------------
1 | # remedy 0.1.0.9000
2 |
3 | * Clean pkgdown on github
4 | * Added travis support and codecov.
5 |
6 | # remedy 0.1.0
7 |
8 | * Added examples.
9 | * CRAN ready version.
10 |
11 | # remedy 0.0.0.9000
12 |
13 | ## 2017-09-21
14 | * Added latex inline
15 | * url and image are now context aware
16 |
17 | ## 2017-09-08
18 |
19 | * First commit on 2017-09-08
20 |
--------------------------------------------------------------------------------
/R/align.R:
--------------------------------------------------------------------------------
1 | ## Currently taken verbatim from
2 | ## https://github.com/seasmith/AlignAssign/blob/b32a2f0847a7818c9768a105cf2d891db0b0ee8d/R/align_assign.R
3 | ## as of 11-Nov-2016
4 | ## since AlignAssign is not on CRAN and CRAN packages can't have Remotes dependencies
5 | ## J. Carroll: I have updated the roxygen tags but otherwise this is as-per that commit
6 |
7 | capture <- function() {
8 | # Get context
9 | rstudioapi::getActiveDocumentContext()
10 | }
11 |
12 | capture_area <- function(capture) {
13 | # Find range
14 | range_start <- capture$selection[[1L]]$range$start[[1L]]
15 | range_end <- capture$selection[[1L]]$range$end[[1L]]
16 |
17 | # Dump contents and use highlighted lines as names.
18 | contents <- capture$contents[range_start:range_end]
19 | names(contents) <- range_start:range_end
20 | return(contents)
21 | }
22 |
23 | find_regex <- function(find, where) {
24 |
25 | # Find matches, extract positions, find furthest <-, get rows/cols to align.
26 | matched.rows <- grep(find, where)
27 | positions <- regexec(find, where)
28 | positions <- positions[matched.rows]
29 |
30 | lines.highlighted <- as.integer(names(where))
31 | matched.cols <- sapply(positions, `[[`, 1L)
32 | which.max.col <- which.max(matched.cols)
33 |
34 | furthest_row <- lines.highlighted[matched.rows[which.max.col]]
35 | furthest_column <- max(matched.cols)
36 |
37 | return(list(matched.rows = matched.rows,
38 | matched.cols = matched.cols,
39 | lines.highlighted = lines.highlighted,
40 | which.max.col = which.max.col,
41 | furthest_column = furthest_column))
42 | }
43 |
44 | assemble_insert <-function(info) {
45 | # Unload variables
46 | matched.rows <- info$matched.rows
47 | matched.cols <- info$matched.cols
48 | lines.highlighted <- info$lines.highlighted
49 | which.max.col <- info$which.max.col
50 | furthest_column <- info$furthest_column
51 |
52 | # Find the rows to align and the current column position of each regEx match.
53 | rows_to_align <- lines.highlighted[matched.rows[-which.max.col]]
54 | columns_to_align <- matched.cols[-which.max.col]
55 |
56 | # Set location for spaces to be inserted.
57 | location <- Map(c, rows_to_align, columns_to_align)
58 |
59 | # Find and set the number of spaces to insert on each line.
60 | text_num <- furthest_column - columns_to_align
61 | text <- vapply(text_num,
62 | function(x) paste0(rep(" ", x), collapse = ""),
63 | character(1))
64 |
65 | return(list(location = location, text = text))
66 | }
67 |
68 | insertr <- function(list) {
69 | rstudioapi::insertText(list[["location"]], list[["text"]])
70 | }
71 |
72 | #' Align a highlighted region's assignment operators.
73 | #'
74 | #' @return Aligns the single assignment operators (\code{<-}) within a highlighted region.
75 | #' @export
76 | #'
77 | #' @examples
78 | #' \dontrun{
79 | #' remedy_example(
80 | #' c( "# Align arrows",
81 | #' "a <- 12",
82 | #' "aaa <- 13"),
83 | #' align_arrow
84 | #' )
85 | #' }
86 | align_arrow <- function() {
87 | capture <- capture()
88 | area <- capture_area(capture)
89 | loc <- find_regex("<-", area)
90 | insertList <- assemble_insert(loc)
91 | insertr(insertList)
92 | }
93 |
94 | #' Align a highlighted region's assignment operators.
95 | #'
96 | #' @return Aligns the equal sign assignment operators (\code{=}) within a
97 | #' highlighted region.
98 | #' @export
99 | #' @examples
100 | #' \dontrun{
101 | #' remedy_example(
102 | #' c( "# Align equal signs",
103 | #' "a = 12",
104 | #' "aaa = 13"),
105 | #' align_equal
106 | #' )
107 | #' }
108 | align_equal <- function() {
109 | capture <- capture()
110 | area <- capture_area(capture)
111 | loc <- find_regex("=", area)
112 | insertList <- assemble_insert(loc)
113 | insertr(insertList)
114 | }
--------------------------------------------------------------------------------
/R/backtickr.R:
--------------------------------------------------------------------------------
1 | #' Backtick
2 | #'
3 | #' Backtick selected word(s)
4 | #'
5 | #' @return a backticked text selection
6 | #' @export
7 | #' @examples
8 | #' \dontrun{
9 | #' remedy_example(
10 | #' c( "to_backtick"),
11 | #' backtickr
12 | #' )
13 | #' }
14 | backtickr <- function() enclose("`")
15 |
--------------------------------------------------------------------------------
/R/blockquoter.R:
--------------------------------------------------------------------------------
1 | #' Convert to blockquote
2 | #'
3 | #' Turn the selected text into a blockquote.
4 | #'
5 | #' @return a markdown blockquote
6 | #' @export
7 | #' @importFrom rstudioapi getSourceEditorContext insertText
8 | #' @examples
9 | #' \dontrun{
10 | #' remedy_example(
11 | #' c( "to_blockquote"),
12 | #' blockquoter
13 | #' )
14 | #' }
15 | blockquoter <- function() add_multiline_prefix('> ', as_is = TRUE)
16 |
--------------------------------------------------------------------------------
/R/chunknamer.R:
--------------------------------------------------------------------------------
1 | #' @title Interactively Add Names to Chunks
2 | #' @description Addin that add in bulk a names to unnamed chunks in a
3 | #' Rmarkdown document in the source editor.
4 | #' @return NULL
5 | #' @details
6 | #'
7 | #' By default the addin will use "remedy" as the stem of the chunk names. this an be changed using
8 | #' \code{\link{remedy_opts}}$set(name='ANOTHER NAME'). The names are then added in sequential order using
9 | #' an %02d naming scheme.
10 | #'
11 | #' @rdname chunknamer
12 | #' @export
13 | chunknamer <- function(){
14 |
15 | adc <- rstudioapi::getSourceEditorContext()
16 |
17 | this <- adc$contents
18 |
19 | x <- grep('^```\\{(.*?)r',this)
20 |
21 | current_names <- gsub('```\\{(.*?)r|\\}|\\s+','',sapply(strsplit(this[x],','),'[',1))
22 |
23 | #remove chunk options that are in first position
24 | no_name_opts <- which(grepl('=',current_names))
25 |
26 | current_names[no_name_opts] <- ""
27 |
28 | no_name <- which(!nzchar(current_names))
29 |
30 | counter_size <- pmax(nchar(as.character(length(no_name))) - 1,2)
31 |
32 | counter <- paste0('%0',counter_size,'d')
33 |
34 | for(i in seq_along(no_name)){
35 |
36 | bump <- 0
37 |
38 | new_name <- sprintf(paste0('%s',counter),remedy_opts$get('name'),(i + bump))
39 |
40 | # in case new name already exists bump counter until unused name is found
41 | while(new_name%in%current_names){
42 | bump <- bump + 1
43 | new_name <- sprintf(paste0('%s',counter),remedy_opts$get('name'),(i + bump))
44 | }
45 |
46 | comma <- ifelse(no_name[i]%in%no_name_opts,',','')
47 |
48 | this[x][no_name[i]] <- gsub('^```\\{(.*?)r',
49 | sprintf('```{r %s%s',new_name,comma),
50 | this[x][no_name[i]]
51 | )
52 |
53 | idx <- x[no_name][i]
54 |
55 | rng <- Map(c, Map(c, idx, 1), Map(c, idx, Inf))
56 |
57 | rstudioapi::modifyRange(rng,this[x][no_name[i]],id = adc$id)
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/R/chunkr.R:
--------------------------------------------------------------------------------
1 | #' @title Interactively Create Rmarkdown Chunks
2 | #' @description Addin that splits full documents into Rmarkdown chunks or
3 | #' wraps highlighted text in an active RStudio document editor in a Rmarkdown chunk.
4 | #' @return NULL
5 | #' @details
6 | #'
7 | #' Setting \code{\link{remedy_opts}}$set(list(full_doc=TRUE)) chunkr will convert entire document by
8 | #' \code{\link{remedy_opts}}$get('token_purl'). The default token is the output from a \code{\link[knitr]{purl}}
9 | #' conversion (## ----chunk name,chunk options----).
10 | #'
11 | #' Setting \code{\link{remedy_opts}}$set(list(full_doc=FALSE)), user highlights text and chunkr will
12 | #' wrap a new Rmarkdown chunk around it, utilizing the other options in \code{\link{remedy_opts}}.
13 | #'
14 | #' @rdname chunkr
15 | #' @export
16 | #'
17 | #' @examples
18 | #' \dontrun{
19 | #' remedy_example(
20 | #' c( "# Create a chunk",
21 | #' "a <- 12",
22 | #' "aaa <- 13"),
23 | #' chunkr
24 | #' )
25 | #' }
26 |
27 | chunkr <- function() {
28 | if (remedy_opts$get("full_doc")) {
29 | chunkr_doc()
30 | } else {
31 | chunkr_section()
32 | }
33 | }
34 |
35 | #' @importFrom rstudioapi getSourceEditorContext
36 | #' @rdname chunkr
37 | chunkr_doc <- function() {
38 | adc <- rstudioapi::getSourceEditorContext()
39 |
40 | find_chunks <- grep(remedy_opts$get('token_purl'), adc$contents)
41 |
42 | if (length(find_chunks) == 0) return(NULL)
43 |
44 | if (length(find_chunks) == 1){
45 | chunk_idx <- list(find_chunks:length(adc$contents))
46 | }else{
47 | chunk_idx <- mapply(seq, find_chunks, to = c(find_chunks[-1] - 1, length(adc$contents)))
48 | }
49 |
50 | new_chunks <- lapply(chunk_idx, function(x) {
51 | this <- adc$contents[x]
52 | this[1] <- sprintf("```{r%s}", gsub("[#-]", "", this[1]))
53 | this[length(x) + 1] <- "```"
54 | this
55 | })
56 |
57 | new_text <- c(adc$contents[1:chunk_idx[[1]][1] - 1], unlist(new_chunks))
58 |
59 | if(nzchar(adc$path)){
60 | cat(new_text, file = adc$path, sep = "\n")
61 | }else{
62 |
63 | tail_pos <- nchar(adc$contents[length(adc$contents)])+1
64 |
65 | add_rng <- Map(c, Map(c, length(adc$contents), tail_pos), Map(c, length(adc$contents), tail_pos))
66 | rstudioapi::setCursorPosition(position = add_rng,id = adc$id)
67 |
68 | add_num <- length(new_text) - length(adc$contents)
69 |
70 | rstudioapi::insertText(location = add_rng,text = strrep('\n',add_num),id = adc$id)
71 |
72 | rng <- Map(c, Map(c, 1:length(new_text), 1), Map(c, 1:length(new_text), max(nchar(adc$contents))+1))
73 | rstudioapi::modifyRange(location = rng, text = new_text,id = adc$id)
74 | }
75 |
76 | }
77 |
78 | #' @importFrom rstudioapi insertText getActiveDocumentContext setCursorPosition
79 | #' @rdname chunkr
80 | #'
81 | chunkr_section <- function() {
82 | adc <- rstudioapi::getActiveDocumentContext()
83 |
84 | newend <- adc$selection[[1]]$range$start[[1]] + (adc$selection[[1]]$range$end[[1]] - adc$selection[[1]]$range$start[[1]]) + 3
85 |
86 | adc$selection[[1]]$range$start[[1]] <- adc$selection[[1]]$range$start[[1]] - 1
87 | adc$selection[[1]]$range$end[[1]] <- newend
88 | adc$selection[[1]]$range$end[[2]] <- 1
89 |
90 | start_text <- "\n```{r"
91 |
92 | if (!remedy_opts$get("basic")) {
93 | if (remedy_opts$get("counter")) {
94 | chunky_num <- length(grep(sprintf("\\`\\`\\`\\{r %s", remedy_opts$get("name")), adc$contents[1:adc$selection[[1]]$range$start[[1]]])) + 1
95 | start_text <- paste(start_text, sprintf("%s%03d", remedy_opts$get("name"), chunky_num))
96 | } else {
97 | start_text <- paste(start_text, remedy_opts$get("name"))
98 | }
99 |
100 | if (!is.null(remedy_opts$get("chunk_opts"))) {
101 | start_text <- paste(start_text, remedy_opts$get("chunk_opts"), sep = ",")
102 | }
103 | }
104 |
105 | start_text <- paste0(start_text, "}\n")
106 |
107 | # Insert text that splits the code chunk in two
108 | rstudioapi::insertText(location = adc$selection[[1]]$range$start, start_text)
109 | rstudioapi::insertText(location = adc$selection[[1]]$range$end, "\n```\n")
110 | }
111 |
--------------------------------------------------------------------------------
/R/chunksplitr.R:
--------------------------------------------------------------------------------
1 | #' @title Split Chunk
2 | #' @description Split a chunk into two chunks
3 | #' @details Will split below row of the current cursor position or under the highlighted text.
4 | #'
5 | #' @rdname chunksplitr
6 | #' @export
7 | #' @importFrom rstudioapi getSourceEditorContext insertText
8 | #'
9 |
10 | chunksplitr <- function(){
11 | adc <- rstudioapi::getSourceEditorContext()
12 |
13 | rng <- rstudioapi::document_range(
14 | start = rstudioapi::document_position(adc$selection[[1]]$range$end[1], Inf),
15 | end = rstudioapi::document_position(adc$selection[[1]]$range$end[1], Inf)
16 | )
17 |
18 | idx <- max(grep('^```\\{r',adc$contents[1:adc$selection[[1]]$range$start[[1]]]))
19 | chunk_params <- paste0(c('r',strsplit(gsub('```\\{|\\}','',adc$contents[idx]),',')[[1]][-1]),collapse = ',')
20 |
21 | rstudioapi::insertText(
22 | location = rng,
23 | text = sprintf("\n```\n \n```{%s}",chunk_params)
24 | )
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/R/emphasize.R:
--------------------------------------------------------------------------------
1 | #' @title Emphasize
2 | #'
3 | #' @description Emphasize the selected text.
4 | #'
5 | #' @return emboldened, italicized or strikethrough text (in markdown)
6 | #'
7 | #' @rdname emphasize
8 | #' @export
9 | #'
10 | #' @examples
11 | #' \dontrun{
12 | #' remedy_example(
13 | #' c( "to_italic"),
14 | #' italicsr
15 | #' )
16 | #' remedy_example(
17 | #' c( "to_bold"),
18 | #' boldr
19 | #' )
20 | #' remedy_example(
21 | #' c( "to_strike"),
22 | #' striker
23 | #' )
24 | #' }
25 | #'
26 | italicsr <- function() enclose("_")
27 |
28 | #' @rdname emphasize
29 | #' @export
30 | #'
31 | boldr <- function() enclose("__")
32 |
33 | #' @rdname emphasize
34 | #' @export
35 | #'
36 | striker <- function() enclose("~~")
37 |
--------------------------------------------------------------------------------
/R/example_utils.R:
--------------------------------------------------------------------------------
1 | #' @title Functions to run examples and tests
2 | #' @description Utility functions to deploy functions and tests for addins
3 | #' @param txt character, text to place in temporary document
4 | #' @param addin function, addin function to deploy
5 | #' @param mark function, highlight using entire_document or individual_lines
6 | #' @param sec source editor context object
7 | #' @return New document in source editor of RStudio
8 | #' @details These function only will work in a RStudio IDE
9 | #' @rdname remedy_example
10 | #' @export
11 | #' @importFrom rstudioapi documentSave
12 | remedy_example <- function(txt, addin, mark = entire_document){
13 | if(interactive()){
14 | sec <- scratch_file()
15 | set_text(paste0(txt,collapse = '\n'), sec = sec, mark = mark)
16 | Sys.sleep(0.5)
17 | addin()
18 | invisible(rstudioapi::documentSave(sec$id))
19 | } else {
20 | message("{remedy} not available in non-interactive sessions.")
21 | }
22 | }
23 |
24 | #' @rdname remedy_example
25 | #' @export
26 | #' @importFrom rstudioapi isAvailable navigateToFile getSourceEditorContext
27 | scratch_file <- function() {
28 | if (rstudioapi::isAvailable()) {
29 | path <- tempfile(pattern = 'remedy', fileext = '.Rmd')
30 | file.create(path)
31 | rstudioapi::navigateToFile(path)
32 | Sys.sleep(1)
33 | rstudioapi::getSourceEditorContext()
34 | }
35 | }
36 |
37 | #' @rdname remedy_example
38 | #' @export
39 | #' @importFrom rstudioapi document_position document_range
40 | entire_document <- function() {
41 | rstudioapi::document_range(start = rstudioapi::document_position(1,1),
42 | end = rstudioapi::document_position(Inf,Inf))
43 | }
44 |
45 | #' @rdname remedy_example
46 | #' @export
47 | #' @importFrom rstudioapi getSourceEditorContext document_position document_range
48 | individual_lines <- function() {
49 | lines <- rstudioapi::getSourceEditorContext()$contents
50 | n <- length(lines)
51 | Map(rstudioapi::document_range,
52 | Map(rstudioapi::document_position, 1:n, 1),
53 | Map(rstudioapi::document_position, 1:n, unlist(lapply(lines, nchar)) + 1)
54 | )
55 | }
56 |
57 | #' @rdname remedy_example
58 | #' @export
59 | #' @importFrom rstudioapi modifyRange documentSave setSelectionRanges
60 | set_text <- function(txt = '', sec, mark) {
61 | rstudioapi::modifyRange(location = entire_document(), text = txt, id = sec$id)
62 | rstudioapi::documentSave(sec$id)
63 | Sys.sleep(.1)
64 | if (!missing(mark))
65 | rstudioapi::setSelectionRanges(mark())
66 | }
67 |
68 | this_strrep <- function(n) sprintf('%s ',strrep('#',times = n))
69 |
--------------------------------------------------------------------------------
/R/footnoter.R:
--------------------------------------------------------------------------------
1 | #' @title Footnote
2 | #'
3 | #' @description Create a footnote from selected text.
4 | #'
5 | #' @return footnote text (in markdown)
6 | #'
7 | #' @rdname footnote
8 | #' @export
9 | #' @importFrom rstudioapi getSourceEditorContext insertText
10 | #' @examples
11 | #' \dontrun{
12 | #' remedy_example(
13 | #' c( "# Create a footnote"),
14 | #' footnoter
15 | #' )
16 | #' }
17 | footnoter <- function() enclose("^[", "]")
18 |
--------------------------------------------------------------------------------
/R/headr.R:
--------------------------------------------------------------------------------
1 | #' @title Convert to header
2 | #'
3 | #' @description Convert selected text into a header.
4 | #'
5 | #'
6 | #' @rdname header
7 | #'
8 | #' @return a markdown header
9 | #' @export
10 | #' @examples
11 | #' \dontrun{
12 | #' remedy_example( c( "h1"), h1r)
13 | #' remedy_example( c( "h2"), h2r)
14 | #' remedy_example( c( "h3"), h3r)
15 | #' remedy_example( c( "h4"), h4r)
16 | #' remedy_example( c( "h5"), h5r)
17 | #' remedy_example( c( "h6"), h6r)
18 | #' }
19 | h1r <- function() add_prefix("# ")
20 |
21 | #' @rdname header
22 | #' @export
23 | h2r <- function() add_prefix("## ")
24 |
25 | #' @rdname header
26 | #' @export
27 | h3r <- function() add_prefix("### ")
28 |
29 | #' @rdname header
30 | #' @export
31 | h4r <- function() add_prefix("#### ")
32 |
33 | #' @rdname header
34 | #' @export
35 | h5r <- function() add_prefix("##### ")
36 |
37 | #' @rdname header
38 | #' @export
39 | h6r <- function() add_prefix("###### ")
40 |
--------------------------------------------------------------------------------
/R/htmlcommentr.R:
--------------------------------------------------------------------------------
1 | #' @title html commenting
2 | #' @description RStudio addin to add/remove html comments to highlighted text
3 | #'
4 | #' @details
5 | #'
6 | #' Highlighting text will add html comment tags around it
7 | #'
8 | #' Highlighting commented text will remove tags.
9 | #'
10 | #' \strong{Highlighting}
11 | #'
12 | #' Something COMMENT Something
13 | #'
14 | #' Something Something
15 | #'
16 | #' \strong{New Comment}
17 | #'
18 | #' Something COMMENT [cursor here] Something
19 | #'
20 | #' Something COMMENT Something
21 | #'
22 | #' \strong{Start of Row}
23 | #'
24 | #' [cursor here] Something COMMENT Something
25 | #'
26 | #'
27 | #'
28 | #' \strong{Highlighting Multiple rows}
29 | #'
30 | #' Something COMMENT Something
31 | #'
32 | #' Something COMMENT Something
33 | #'
34 | #'
37 | #'
38 | #' @rdname htmlcommentr
39 | #' @export
40 | #' @importFrom rstudioapi getSourceEditorContext modifyRange setCursorPosition
41 | #'
42 | #' @examples
43 | #' \dontrun{
44 | #' remedy_example( c( "This is bold"), htmlcommentr)
45 | #' }
46 | htmlcommentr <- function(){
47 |
48 | adc <- rstudioapi::getSourceEditorContext()
49 |
50 | rng <- adc$selection[[1]]$range
51 | txt <- adc$selection[[1]]$text
52 |
53 | txt <- gsub('^\\s+|\\s+$','',txt)
54 |
55 | push <- 6
56 |
57 | if(!nzchar(txt)&rng$start[2]==1){
58 | rng$end[2] <- Inf
59 | txt <- adc$contents[rng$start[1]]
60 | txt <- gsub('^\\s+|\\s+$','',txt)
61 | push <- 0
62 | }
63 |
64 | if(grepl('^$',txt)){
65 |
66 | txt <- gsub('^$','',txt)
67 | txt <- gsub('^\\s+|\\s+$','',txt)
68 | push <- 0
69 |
70 | }else{
71 |
72 | txt <- sprintf(" ",txt)
73 |
74 | }
75 |
76 |
77 | rstudioapi::modifyRange(location = rng,
78 | text = txt,
79 | id = adc$id)
80 |
81 | rng$start[2] <- rng$start[2] + push
82 |
83 | rstudioapi::setCursorPosition(position = rng$start,id = adc$id)
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/R/imager.R:
--------------------------------------------------------------------------------
1 | #' @title Imager
2 | #'
3 | #' @description Convert the selected path into an embedded image
4 | #'
5 | #'
6 | #' @return a markdown image link
7 | #' @export
8 | #' @importFrom rstudioapi getSourceEditorContext modifyRange
9 | #'
10 | #' @examples
11 | #' \dontrun{
12 | #' remedy_example(
13 | #' c( "https://thinkr.fr/wp-content/uploads/2015/03/thinkR1.png"),
14 | #' imager
15 | #' )
16 | #' }
17 | imager <- function() {
18 |
19 | adc <- rstudioapi::getSourceEditorContext()
20 |
21 | before_last_space <- '(\\s)(?!.*\\s)(.*?)$'
22 | after_last_space <- '^(.*?)(\\s)(?!.*\\s)'
23 |
24 | txt <- adc$selection[[1]]$text
25 |
26 | txt_last <- gsub(after_last_space,'',txt, perl = TRUE)
27 | txt_last <- ifelse(is_link(txt_last),txt_last,"# Error : selection is not an image link")
28 |
29 | content <- switch(as.character(strc(txt = txt)),
30 | '0' = '![]()' ,
31 | '-1' = sprintf('',txt_last),
32 | sprintf('',gsub(before_last_space,'',txt, perl = TRUE),txt_last)
33 | )
34 |
35 | rstudioapi::modifyRange(location = adc$selection[[1]]$range, text = content, id = adc$id)
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/R/internal.R:
--------------------------------------------------------------------------------
1 | #' @importFrom rstudioapi getSourceEditorContext insertText
2 |
3 | add_prefix <- function(prefix) {
4 | a <- rstudioapi::getSourceEditorContext()
5 | s <- a$selection
6 | n <- length(s)
7 | # if no text is selected
8 | if (n == 1L && nchar(s[[1L]]$text) == 0L) {
9 | pos <- s[[1L]]$range$start
10 | pos[2L] <- 1
11 | rstudioapi::insertText(location = pos, text = prefix)
12 | } else {
13 | for (i in s)
14 | rstudioapi::insertText(location = i$range$start, text = prefix)
15 | }
16 | }
17 |
18 | add_multiline_prefix <- function(prefix, as_is = FALSE) {
19 | a <- rstudioapi::getSourceEditorContext()
20 |
21 | content <- strsplit(a$selection[[1]]$text, "\n")[[1]]
22 |
23 | # https://stackoverflow.com/a/47072999/3218296
24 | prefix_content <- iconv(content, "latin1", "ASCII", sub="")
25 |
26 | prefix_content <- gsub('^["]','',prefix_content)
27 |
28 | if (as_is) {
29 | # blockquote: keep blank lines, ignore indentation
30 | content <- paste0(prefix, content)
31 | } else {
32 | # list: ignore blank lines, keep indentation
33 | content[nzchar(content)] <-
34 | paste0(
35 | gsub("\\b.*$", "", prefix_content[nzchar(content)], perl = TRUE),
36 | prefix,
37 | gsub("^\\s*", "", content[nzchar(content)])
38 | )
39 | }
40 |
41 | if (length(content) > 0) {
42 | content <- paste0(content, "\n", collapse = "")
43 | } else {
44 | content <- ""
45 | }
46 |
47 | rstudioapi::modifyRange(
48 | location = a$selection[[1]]$range,
49 | text = content,
50 | id = a$id
51 | )
52 | }
53 |
54 | enclose <- function(prefix, postfix = prefix) {
55 | a <- rstudioapi::getSourceEditorContext()
56 | for (s in a$selection)
57 | rstudioapi::insertText(location = s$range, text = sprintf("%s%s%s", prefix, s$text, postfix))
58 | }
59 |
--------------------------------------------------------------------------------
/R/latexr.R:
--------------------------------------------------------------------------------
1 | #' @title LaTeX
2 | #'
3 | #' @description Convert the selected text in inline LaTeX.
4 | #'
5 | #' @return inline LaTeX text (in markdown)
6 | #'
7 | #' @rdname latex
8 | #' @export
9 | #'
10 | #' @examples
11 | #' \dontrun{
12 | #' remedy_example(
13 | #' c( "Latex stuffs"),
14 | #' latexr
15 | #' )
16 | #' }
17 | #'
18 | latexr <- function() enclose("$")
19 |
--------------------------------------------------------------------------------
/R/listr.R:
--------------------------------------------------------------------------------
1 | #' @title Convert to list
2 | #'
3 | #' @description Convert selected text into an (un)ordered list.
4 | #'
5 | #' @examples
6 | #' \dontrun{
7 | #' #unordered list
8 | #' remedy_example(c('line 1','line 2'),listr)
9 | #'
10 | #' #ordered list
11 | #' remedy_example(c('line 1','line 2'),olistr)
12 | #' }
13 | #' @return \code{listr()} returns an unordered markdown list
14 | #' @export
15 | #' @importFrom rstudioapi getSourceEditorContext insertText
16 | #'
17 | listr <- function() add_multiline_prefix('+ ', as_is = FALSE)
18 |
19 | #' @return \code{olistr()} returns an ordered markdown list
20 | #' @export
21 | #' @importFrom rstudioapi getSourceEditorContext insertText
22 | #' @rdname listr
23 | olistr <- function() add_multiline_prefix('1. ', as_is = FALSE)
24 |
--------------------------------------------------------------------------------
/R/mover.R:
--------------------------------------------------------------------------------
1 | #' @title Mover
2 | #'
3 | #' @description Copy a selected text or the current line to the right
4 | #'
5 | #' @rdname move
6 | #'
7 | #' @return a clone of the line
8 | #' @export
9 | #' @importFrom rstudioapi getSourceEditorContext modifyRange setCursorPosition showDialog
10 | #'
11 | #' @examples
12 | #' \dontrun{
13 | #' remedy_example(
14 | #' c( "I like to move it "),
15 | #' rightr
16 | #' )
17 | #' }
18 | #'
19 | rightr <- function(){
20 | adc <- rstudioapi::getSourceEditorContext()
21 | rg <- adc$selection[[1]]$range
22 |
23 | rows <- rg$end[[1]] - rg$start[[1]]
24 |
25 | if(rows>0){
26 | message(sprintf('This addin assumes one line is selected, %s were selected',rows + 1 ))
27 | return(NULL)
28 | }
29 |
30 | # If text is selected
31 | if (nzchar(adc$selection[[1]]$text)) {
32 |
33 | rstudioapi::modifyRange(location = rg, text = strrep(adc$selection[[1]]$text,2))
34 | rg$end[[2]] <- rg$start[[2]] + nchar(strrep(adc$selection[[1]]$text,2))
35 |
36 | } else {
37 |
38 | rg$start[[2]] <- 1
39 | rg$end[[2]] <- Inf
40 | rstudioapi::modifyRange(location = rg,
41 | text = strrep(adc$contents[rg$start[[1]]],2),
42 | id = adc$id)
43 | }
44 |
45 | rstudioapi::setCursorPosition(rg$end)
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/R/opts.R:
--------------------------------------------------------------------------------
1 | # forked from https://github.com/yihui/knitr/blob/master/R/defaults.R
2 | new_defaults = function(value = list()) {
3 | defaults = value
4 |
5 | get = function(name, default = FALSE, drop = TRUE) {
6 | if (default) defaults = value # this is only a local version
7 | if (missing(name)) defaults else {
8 | if (drop && length(name) == 1) defaults[[name]] else {
9 | stats::setNames(defaults[name], name)
10 | }
11 | }
12 | }
13 | resolve = function(...) {
14 | dots = list(...)
15 | if (length(dots) == 0) return()
16 | if (is.null(names(dots)) && length(dots) == 1 && is.list(dots[[1]]))
17 | if (length(dots <- dots[[1]]) == 0) return()
18 | dots
19 | }
20 | set = function(...) {
21 | dots = resolve(...)
22 | if (length(dots)) defaults <<- merge(dots)
23 | invisible(NULL)
24 | }
25 | merge = function(values) merge_list(defaults, values)
26 | restore = function(target = value) defaults <<- target
27 | append = function(...) {
28 | dots = resolve(...)
29 | for (i in names(dots)) dots[[i]] <- c(defaults[[i]], dots[[i]])
30 | if (length(dots)) defaults <<- merge(dots)
31 | invisible(NULL)
32 | }
33 |
34 | list(get = get, set = set, append = append, merge = merge, restore = restore)
35 | }
36 |
37 | #' @title Default and current remedy options
38 | #'
39 | #' @description Options for functions in the remedy package. When running R code, the object \code{remedy_opts}
40 | #' (default options) is not modified by chunk headers (local chunk options are
41 | #' merged with default options), whereas \code{remedy_opts_current} (current options)
42 | #' changes with different chunk headers and it always reflects the options for
43 | #' the current chunk.
44 | #'
45 | #' Normally we set up the global options once in the first code chunk in a
46 | #' document using \code{remedy_opts$set()}, so that all \emph{latter} chunks will
47 | #' use these options. Note the global options set in one chunk will not affect
48 | #' the options in this chunk itself, and that is why we often need to set global
49 | #' options in a separate chunk.
50 | #'
51 | #' Below is a list of default chunk options, retrieved via
52 | #' \code{remedy_opts$get()}:
53 | #'
54 | # @references Usage: \url{https://yihui.name/knitr/objects/}
55 | #'
56 | # A list of available options:
57 | # \url{https://yihui.name/knitr/options/#chunk_options}
58 | #' @note \code{remedy_opts_current} is read-only in the sense that it does nothing if
59 | #' you call \code{remedy_opts_current$set()}; you can only query the options via
60 | #' \code{remedy_opts_current$get()}.
61 | #' @export
62 | #' @rdname remedyOpts
63 | #' @examples remedy_opts$get()
64 | remedy_opts <- new_defaults(list(
65 | basic=FALSE,
66 | name='remedy',
67 | counter=TRUE,
68 | chunk_opts=NULL,
69 | kable_opts=NULL,
70 | full_doc=FALSE,
71 | token_purl='^#{2} -{4}(.*?)-{4,}$',
72 | token_url = "^(?:(?:https?|ftp|file)://|www\\.|ftp\\.)[A-z0-9+&@#/%=~_|$?!:,.-]*[A-z0-9+&@#/%=~_|$]$", # URL regex
73 | token_rel_link = "^.*[/|\\.][^\\.]+$", # Relative link regex
74 | token_img_link = c('jpeg','jpg','png','gif'), # Image link
75 | youtube_output = 'html',
76 | youtube_width = '100%',
77 | youtube_height = '400',
78 | hotkeys = c(
79 | backtick = "Ctrl+Cmd+`",
80 | bold = "Ctrl+Cmd+B",
81 | chunk = "Ctrl+Alt+Cmd+C",
82 | chunksplit = "Ctrl+Shift+Alt+C",
83 | chunkname = "Ctrl+Shift+Alt+N",
84 | footnote = "Ctrl+Cmd+Shift+6",
85 | h1 = "Ctrl+Cmd+1",
86 | h2 = "Ctrl+Cmd+2",
87 | h3 = "Ctrl+Cmd+3",
88 | h4 = "Ctrl+Cmd+4",
89 | h5 = "Ctrl+Cmd+5",
90 | h6 = "Ctrl+Cmd+6",
91 | htmlcomment = "Ctrl+Alt+C",
92 | image = "Ctrl+Cmd+P",
93 | italics = "Ctrl+Cmd+I",
94 | latex = "Ctrl+Cmd+L",
95 | list = "Ctrl+Shift+Cmd+=",
96 | right = "Alt+Cmd+Right",
97 | strike = "Ctrl+Cmd+S",
98 | table = "Ctrl+Cmd+T",
99 | url = "Ctrl+Cmd+U",
100 | xaringan = "Ctrl+Cmd+X",
101 | youtube = "Ctrl+Cmd+Y"
102 | )
103 | ))
104 |
105 | #' @rdname remedyOpts
106 | #' @export
107 | remedy_opts_current <- new_defaults()
108 |
109 | # merge elements of y into x with the same names
110 | merge_list <- function(x, y) {
111 | x[names(y)] <- y
112 | x
113 | }
114 |
115 | #from stats
116 | setNames <- function (object = nm, nm)
117 | {
118 | names(object) <- nm
119 | object
120 | }
--------------------------------------------------------------------------------
/R/opts_complete.R:
--------------------------------------------------------------------------------
1 | #borrowed main bits from https://github.com/jimhester/completeme (when it is put on CRAN will import directly from it)
2 |
3 | the <- new.env(parent = emptyenv())
4 | the$completions <- list()
5 | complete_token <- get(".completeToken", asNamespace("utils"))
6 |
7 | # Register completion functions
8 | #
9 | # Completion functions should take one parameter `env`, the completion
10 | # environment, see `?rc.settings` for details of this environment. They should
11 | # simply return any completions found or `return(NULL)` otherwise.
12 | #
13 | # If all registered completions do not have any completions for a given
14 | # context, than R's standard completions are used.
15 | # @param ... One or more completion functions specified as named parameters.
16 | #' @importFrom utils modifyList
17 | register_completion <- function(...) {
18 | funs <- list(...)
19 |
20 | nms <- names(funs)
21 | if (is.null(nms) || any(nms == "" | is.na(nms))) {
22 | wch <- if (is.null(nms)) 1 else which(nms == "" | is.na(nms))
23 | stop("All arguments must be named")
24 | }
25 |
26 | old <- the$completions
27 | the$completions <- utils::modifyList(the$completions, funs)
28 |
29 | invisible(old)
30 | }
31 |
32 | #' @importFrom utils rc.options
33 | completeme <- function(env) {
34 | env$fileName <- FALSE
35 | for (fun in the$completions) {
36 | env$comps <- fun(env)
37 | if (length(env$comps) > 0) {
38 | attributes(env$comps) <- list(class = "completions", type = 15)
39 | # this_type <- attr(env$comps, "type") %||% 15
40 | return(invisible(env$comps))
41 | }
42 | }
43 |
44 | env$comps <- character()
45 |
46 | # if in the IDE, throw an error to fallback on normal completion
47 | if (rstudioapi::isAvailable()) {
48 | stop("No custom completions")
49 | }
50 |
51 | # If on the command line, fall back to using the default completer
52 | on.exit(rc.options(custom.completer = completeme))
53 | rc.options(custom.completer = NULL)
54 | complete_token()
55 |
56 | invisible(env$comps)
57 | }
58 |
59 | #' @importFrom rematch2 re_match
60 | current_function <- function(env) {
61 | buffer <- env[["linebuffer"]]
62 | fun <- rematch2::re_match(buffer, "(?[^[:space:](]+)[(][^(]*$")$fun
63 | if (is.na(fun)) {
64 | return("")
65 | }
66 | fun
67 | }
68 |
69 | populate <- function(env){
70 |
71 | fun <- current_function(env)
72 |
73 | this_ns <- find_the()
74 |
75 | this_fn <- lapply(this_ns,function(x) ls(envir = asNamespace(x),pattern = 'opts$'))
76 |
77 | nms <- lapply(this_fn,function(x) names(get(x)$get()))
78 |
79 | comp <- NULL
80 |
81 | if(length(fun) > 0){
82 | for(i in seq_along(this_ns)){
83 | if(fun %in% build_fields(ns = this_ns[i],fn = this_fn[[i]])){
84 | comp <- nms[[i]]
85 | }
86 | }
87 | }
88 |
89 | return(comp)
90 |
91 | }
92 |
93 | build_fields <- function(fields = c('set','append'),ns='ns',fn='fn'){
94 | c(
95 | sprintf('%s::%s$%s',ns,fn,fields),
96 | sprintf('%s$%s',fn,fields)
97 | )
98 | }
99 |
100 | find_the <- function(){
101 | names(which(sapply(loadedNamespaces(),function(x) any(grepl('^the$',ls(envir = asNamespace(x)))))))
102 | }
103 |
104 | .onLoad <- function(lib,pkg) {
105 | rc.options(custom.completer = completeme)
106 | register_completion(thispkg = populate)
107 | }
108 |
--------------------------------------------------------------------------------
/R/referr.R:
--------------------------------------------------------------------------------
1 | #' @importFrom rstudioapi getSourceEditorContext modifyRange
2 | ref_ <- function(prefix){
3 | adc <- rstudioapi::getSourceEditorContext()
4 | content <- sprintf("\\@ref(%s%s)", prefix, adc$selection[[1]]$text)
5 | rstudioapi::modifyRange(
6 | location = adc$selection[[1]]$range,
7 | text = content,
8 | id = adc$id
9 | )
10 | }
11 |
12 | #' @title urlr
13 | #'
14 | #' @description Convert selected text into a markdown ref.
15 | #'
16 | #' @note Only the three most common reference types are implemented: id, fig, and tab.
17 | #'
18 | #' @return A referenced content
19 | #' @export
20 | #'
21 | #' @rdname ref
22 | #' @examples
23 | #' \dontrun{
24 | #' remedy_example(
25 | #' "pouet",
26 | #' id_ref
27 | #' )
28 | #' }
29 | #'
30 | id_ref <- function(){
31 | ref_(prefix = "#")
32 | }
33 |
34 | fig_ref <- function(){
35 | ref_(prefix = "fig:")
36 | }
37 |
38 | tab_ref <- function(){
39 | ref_(prefix = "tab:")
40 | }
--------------------------------------------------------------------------------
/R/remedy-package.R:
--------------------------------------------------------------------------------
1 | #' @keywords internal
2 | "_PACKAGE"
3 |
4 | # The following block is used by usethis to automatically manage
5 | # roxygen namespace tags. Modify with care!
6 | ## usethis namespace: start
7 | ## usethis namespace: end
8 | NULL
9 |
--------------------------------------------------------------------------------
/R/tabler.R:
--------------------------------------------------------------------------------
1 | #' @title Tabler
2 | #'
3 | #' @description Insert a table in your file.
4 | #'
5 | #' @return a markdown table
6 | #' @export
7 | #' @importFrom rstudioapi getSourceEditorContext insertText
8 | #' @importFrom knitr kable
9 | #' @examples
10 | #' \dontrun{
11 | #' remedy_example(
12 | #' "head(iris)",
13 | #' tabler
14 | #' )
15 | #' }
16 | #'
17 | tabler <- function(){
18 | adc <- rstudioapi::getSourceEditorContext()
19 |
20 | src_txt <- adc$selection[[1]]$text
21 |
22 | if(nzchar(src_txt)){
23 | eval(parse(text=sprintf('tbl <- %s',src_txt)))
24 | if(!class(tbl)%in%c('data.frame','tibble','matrix','numeric')){
25 | message('Highlighted text: ', paste0(src_txt,collapse='\n') ,', not data.frame,tibble,matrix or numeric')
26 | return(NULL)
27 | }
28 | }else{
29 | tbl <- data.frame(a=1:2,b=2:3,c=3:4)
30 | }
31 |
32 | args=c(remedy_opts$get('kable_opts'),list(x=tbl))
33 |
34 | tbl_knit <- do.call(knitr::kable,args=args)
35 |
36 | tbl_knit <- paste0(as.character(tbl_knit),collapse = '\n')
37 |
38 | rstudioapi::insertText(location = adc$selection[[1]]$range, text = tbl_knit,id=adc$id)
39 | }
40 |
--------------------------------------------------------------------------------
/R/urlr.R:
--------------------------------------------------------------------------------
1 | #' @title urlr
2 | #'
3 | #' @description Convert selected text into a link
4 | #'
5 | #' @return a markdown link
6 | #' @export
7 | #' @importFrom rstudioapi getSourceEditorContext modifyRange
8 | #'
9 | #' @examples
10 | #' \dontrun{
11 | #' remedy_example(
12 | #' "https://www.thinkr.fr",
13 | #' urlr
14 | #' )
15 | #' }
16 | #'
17 | urlr <- function() {
18 |
19 | adc <- rstudioapi::getSourceEditorContext()
20 |
21 | before_last_space <- '(\\s)(?!.*\\s)(.*?)$'
22 | after_last_space <- '^(.*?)(\\s)(?!.*\\s)'
23 |
24 | txt <- adc$selection[[1]]$text
25 |
26 | txt_last <- gsub(after_last_space,'',txt, perl = TRUE)
27 | txt_last <- ifelse(is_link(txt_last),txt_last,"# Error : selection is not a URL")
28 |
29 | content <- switch(as.character(strc(txt = txt)),
30 | '0' = '[]()' ,
31 | '-1' = {
32 | if(is_link(txt_last)){
33 | sprintf('[%s](%s)',txt_last,txt_last)
34 | }else{
35 | sprintf('[](%s)',txt_last,txt_last)
36 | }
37 | },
38 | sprintf('[%s](%s)',gsub(before_last_space,'',txt, perl = TRUE),txt_last)
39 | )
40 |
41 | rstudioapi::modifyRange(location = adc$selection[[1]]$range, text = content, id = adc$id)
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/R/utils.R:
--------------------------------------------------------------------------------
1 | #' Check if text is a relative link or URL
2 | #'
3 | #' @param text A character string
4 | #'
5 | #' @return TRUE or FALSE
6 | #' @export
7 | #'
8 | #' @examples
9 | #' is_link("www.google.com")
10 | #' is_link("figs/plot.png")
11 | is_link <- function(text) {
12 |
13 | img_link <- sprintf('^(%s)$',paste0('.',remedy_opts$get('token_img_link'),collapse='|'))
14 |
15 | grepl(sprintf('(%s)|(%s)|(%s)',remedy_opts$get('token_url'),remedy_opts$get('token_rel_link'),img_link),text)
16 | }
17 |
18 | strc <- function(p = '\\s',txt){
19 |
20 | if(!nzchar(txt))
21 | return(0)
22 |
23 | ret <- as.numeric(gregexpr(p,txt)[[1]])
24 |
25 | if(-1%in%ret)
26 | return(-1)
27 |
28 | return(length(ret))
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/R/xaringan.R:
--------------------------------------------------------------------------------
1 | #' @title xaringan
2 | #'
3 | #' @description xaringan pull left and pull right
4 | #'
5 | #' @return a template for xaringan pull left and right
6 | #' @export
7 | #'
8 | #' @examples
9 | #' \dontrun{
10 | #' remedy_example(
11 | #' "",
12 | #' xaringanr
13 | #' )
14 | #' }
15 | #'
16 | xaringanr <- function(){
17 | enclose(".pull-left[\n\n]\n", "\n.pull-right[\n\n]\n")
18 | }
19 |
--------------------------------------------------------------------------------
/R/youtuber.R:
--------------------------------------------------------------------------------
1 | #' @title Addin to create markdown youtube links
2 | #' @description Highlight youtube link in source editor and it will be converted
3 | #' to a markdown link with an image saved in youtube.
4 | #'
5 | #' @details
6 | #'
7 | #' if remedy_opts$get('youtube_output')=='md' then the output will be of the form
8 | #'
9 | #' [](Link to Video). (useful for github readme)
10 | #'
11 | #' if remedy_opts$get('youtube_output')=='html' then the output will be of the form
12 | #'
13 | #'
15 | #'
16 | #' Default Settings:
17 | #'
18 | #' remedy_opts$get('youtube_output'): str(remedy::remedy_opts$get('youtube_output'))
19 | #'
20 | #' remedy_opts$get('youtube_height'): str(remedy::remedy_opts$get('youtube_height'))
21 | #'
22 | #' remedy_opts$get('youtube_width'): str(remedy::remedy_opts$get('youtube_width'))
23 | #'
24 | #' @rdname youtuber
25 | #' @export
26 | #' @importFrom rstudioapi getSourceEditorContext modifyRange
27 | #'
28 | #' @examples
29 | #' \dontrun{
30 | #' remedy_example(
31 | #' "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
32 | #' youtuber
33 | #' )
34 | #' }
35 | youtuber <- function(){
36 |
37 | adc <- rstudioapi::getSourceEditorContext()
38 |
39 | txt <- adc$selection[[1]]$text
40 |
41 | token <- substr(txt,max(gregexpr('[/]',txt)[[1]])+1,nchar(txt)) #remove to last /
42 | token <- gsub('watch\\?v\\=','',token) #clean watch?v=token'
43 | root <- gsub('\\?(.*?)$','',token) #clean token?t=2
44 |
45 | new_txt <- switch(remedy_opts$get('youtube_output'),
46 | md = {
47 | sprintf('[](https://www.youtube.com/watch?v=%s)',
48 | root,token)
49 | },
50 | html = {
51 | sprintf('',
52 | remedy_opts$get('youtube_width'),
53 | remedy_opts$get('youtube_height'),
54 | token)
55 | }
56 | )
57 |
58 |
59 | rg <- adc$selection[[1]]$range
60 | rstudioapi::modifyRange(location = rg, text = new_txt,id = adc$id)
61 |
62 | }
--------------------------------------------------------------------------------
/README.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: github_document
3 | ---
4 |
5 |
6 |
7 | ```{r, echo=FALSE, results=FALSE}
8 | knitr::opts_chunk$set(
9 | collapse = TRUE,
10 | comment = "#>",
11 | fig.path = "README-"
12 | )
13 | # Copy reference/images to man/images
14 | # reference folder is required to work with pkgdown
15 | if (!dir.exists("man/figures")) {dir.create("man/figures")}
16 | file.copy(list.files("reference/figures", full.names = TRUE),
17 | "man/figures", overwrite = TRUE)
18 | if (dir.exists("docs")) {
19 | file.copy("reference/figures/thinkr-hex-remedy-favicon.ico",
20 | "docs/favicon.ico", overwrite = TRUE)
21 | }
22 | ```
23 |
24 |
25 |
26 | [](https://cran.r-project.org/package=remedy)
27 | [](https://cran.r-project.org/package=remedy)[](https://travis-ci.org/ThinkR-open/remedy)[](https://codecov.io/github/ThinkR-open/remedy?branch=master)[](http://tinyurl.com/y76olv3v)
28 |
29 |
30 |
31 |
32 | # remedy
33 |
34 | `{remedy}` provides addins to facilitate writing in markdown with RStudio.
35 |
36 | 
37 |
38 | All the functions are meant to be mapped to keyboard shortcuts. A list of suggested shortcuts is provided towards the end of this README.
39 |
40 | > Note that most of the addins/shortcuts below will also work without selecting any text.
41 |
42 | ## Install
43 |
44 | ```{r, eval = FALSE}
45 | remotes::install_github("ThinkR-open/remedy")
46 | ```
47 |
48 | Once you've installed the package, you don't need to load it with `library()`, the addins are installed on your machine as part of the package install process.
49 |
50 | ## Using `{remedy}`
51 |
52 | Write quicker in markdown with `{remedy}`!
53 | Read the full manual in the associated {pkgdown} website:
54 |
55 |
56 | Here's a list of all available helpers:
57 |
58 | 
59 |
60 | You can also have an overview of how the functions behave with the `remedy_example()` function:
61 |
62 | ```{r eval = FALSE}
63 | library(remedy)
64 | remedy_example( c("Never gonna", "give you up", "let you down"), listr )
65 | ```
66 |
67 |
68 | ### Align
69 |
70 | Align selected blocks to their assignment operator, either `<-`
71 |
72 | 
73 |
74 | or `=`
75 |
76 | 
77 |
78 | ### Backtick
79 |
80 | Enclose the selected word(s) in backticks.
81 |
82 | 
83 |
84 | ### Blockquote
85 |
86 | Turn selected line(s) to blockquote.
87 |
88 | 
89 |
90 | ### Chunk
91 |
92 | Turn the selected text into a chunk.
93 |
94 | 
95 |
96 | > Note that every chunk is given a name.
97 |
98 | chunksplit split the chunk at a given spot.
99 |
100 | 
101 |
102 | ### Cross references
103 |
104 | ID, table and figure cross-reference
105 |
106 | 
107 |
108 | ### Emphasize
109 |
110 | Embolden, italicize or strikethrough the selected text.
111 |
112 | 
113 |
114 | ### Footnotes
115 |
116 | Turn the given text into a footnote.
117 |
118 | 
119 |
120 | ### Headers
121 |
122 | Turn the selected text into a header.
123 |
124 | 
125 |
126 | ### HTML Comment
127 |
128 | Turn the text into an html comment
129 |
130 | 
131 |
132 | ### Image
133 |
134 | Turn the selected path into an image.
135 |
136 | This element is context aware: if you select a text and a link, it turns the text into title between `![]`, and puts the link between `()`.
137 |
138 | If the last element of the selection is not a link, you get an error message straight into you markdown document.
139 |
140 | 
141 |
142 | ### LaTeX
143 |
144 | LaTeX syntax :
145 |
146 | 
147 |
148 | ### List
149 |
150 | Turn the selected text into an unordered list.
151 |
152 | 
153 |
154 | ### Moving
155 |
156 | #### On the right
157 |
158 | Copy the selected text or the current line to the right.
159 |
160 | 
161 |
162 |
163 | ### Table
164 |
165 | Insert a table inside your doc.
166 |
167 | There are basically two way to do that with remedy :
168 |
169 | #### Ttable
170 |
171 | 
172 |
173 | #### Parse your data
174 |
175 | Turn your dataframe into a markdown table :
176 |
177 | 
178 |
179 |
180 | ### URL
181 |
182 | Turn the selected text into a link.
183 |
184 | This element is context aware: if you select a text and a link, it turns the text into title between `[]`, and puts the link between `()`.
185 |
186 | If the last element of the selection is not a link, you get an error message straight into you markdown document.
187 |
188 | 
189 |
190 | ### Youtube
191 |
192 | Turn an url into a youtube embed:
193 |
194 | 
195 |
196 | ### xaringan
197 |
198 | Insert a xaringan pull-left and pull-right template.
199 |
200 | 
201 |
202 | ## Recommended shortcuts (macOS)
203 |
204 | Here's a list of recommended shortcuts:
205 |
206 | ```{r}
207 | remedy::remedy_opts$get('hotkeys')
208 | ```
209 |
210 | ### Managing Shortcuts
211 |
212 | Use the [`{rsam}`](https://github.com/yonicd/rsam) package to set and manage for you the hotkey settings of `{remedy}`.
213 |
214 | If you want to edit the default settings you can view the defaults `remedy_opts$get('hotkeys')` and change them through `remedy_opts$set(hotkeys=)`.
215 |
216 | ```{r, eval = FALSE}
217 | hotkeys <- remedy::remedy_opts$get("hotkeys")
218 | rsam::set_shortcut(sprintf('remedy::%sr',names(hotkeys)), hotkeys)
219 | ```
220 |
221 | ## Feedback and enhancement
222 |
223 | You've found a bug, or have an enhancement idea? Feel free to open an issue : [https://github.com/ThinkR-open/remedy/issues](https://github.com/ThinkR-open/remedy/issues).
224 |
225 | ## Code of conduct
226 |
227 | Please note that the 'remedy' project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.
228 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | [](https://cran.r-project.org/package=remedy)
6 | [](https://cran.r-project.org/package=remedy)[](https://travis-ci.org/ThinkR-open/remedy)[](https://codecov.io/github/ThinkR-open/remedy?branch=master)[](http://tinyurl.com/y76olv3v)
11 |
12 |
13 |
14 |
15 | remedy
16 | ======
17 |
18 | `{remedy}` provides addins to facilitate writing in markdown with
19 | RStudio.
20 |
21 | 
22 |
23 | All the functions are meant to be mapped to keyboard shortcuts. A list
24 | of suggested shortcuts is provided towards the end of this README.
25 |
26 | > Note that most of the addins/shortcuts below will also work without
27 | > selecting any text.
28 |
29 | Install
30 | -------
31 |
32 | remotes::install_github("ThinkR-open/remedy")
33 |
34 | Once you’ve installed the package, you don’t need to load it with
35 | `library()`, the addins are installed on your machine as part of the
36 | package install process.
37 |
38 | Using `{remedy}`
39 | ----------------
40 |
41 | Write quicker in markdown with `{remedy}`!
42 | Read the full manual in the associated {pkgdown} website:
43 | https://thinkr-open.github.io/remedy/
44 |
45 | Here’s a list of all available helpers:
46 |
47 | 
48 |
49 | You can also have an overview of how the functions behave with the
50 | `remedy_example()` function:
51 |
52 | library(remedy)
53 | remedy_example( c("Never gonna", "give you up", "let you down"), listr )
54 |
55 | ### Align
56 |
57 | Align selected blocks to their assignment operator, either `<-`
58 |
59 | 
60 |
61 | or `=`
62 |
63 | 
64 |
65 | ### Backtick
66 |
67 | Enclose the selected word(s) in backticks.
68 |
69 | 
70 |
71 | ### Blockquote
72 |
73 | Turn selected line(s) to blockquote.
74 |
75 | 
76 |
77 | ### Chunk
78 |
79 | Turn the selected text into a chunk.
80 |
81 | 
82 |
83 | > Note that every chunk is given a name.
84 |
85 | chunksplit split the chunk at a given spot.
86 |
87 | 
88 |
89 | ### Cross references
90 |
91 | ID, table and figure cross-reference
92 |
93 | 
94 |
95 | ### Emphasize
96 |
97 | Embolden, italicize or strikethrough the selected text.
98 |
99 | 
100 |
101 | ### Footnotes
102 |
103 | Turn the given text into a footnote.
104 |
105 | 
106 |
107 | ### Headers
108 |
109 | Turn the selected text into a header.
110 |
111 | 
112 |
113 | ### HTML Comment
114 |
115 | Turn the text into an html comment
116 |
117 | 
118 |
119 | ### Image
120 |
121 | Turn the selected path into an image.
122 |
123 | This element is context aware: if you select a text and a link, it turns
124 | the text into title between `![]`, and puts the link between `()`.
125 |
126 | If the last element of the selection is not a link, you get an error
127 | message straight into you markdown document.
128 |
129 | 
130 |
131 | ### LaTeX
132 |
133 | LaTeX syntax :
134 |
135 | 
136 |
137 | ### List
138 |
139 | Turn the selected text into an unordered list.
140 |
141 | 
142 |
143 | ### Moving
144 |
145 | #### On the right
146 |
147 | Copy the selected text or the current line to the right.
148 |
149 | 
150 |
151 | ### Table
152 |
153 | Insert a table inside your doc.
154 |
155 | There are basically two way to do that with remedy :
156 |
157 | #### Ttable
158 |
159 | 
160 |
161 | #### Parse your data
162 |
163 | Turn your dataframe into a markdown table :
164 |
165 | 
166 |
167 | ### URL
168 |
169 | Turn the selected text into a link.
170 |
171 | This element is context aware: if you select a text and a link, it turns
172 | the text into title between `[]`, and puts the link between `()`.
173 |
174 | If the last element of the selection is not a link, you get an error
175 | message straight into you markdown document.
176 |
177 | 
178 |
179 | ### Youtube
180 |
181 | Turn an url into a youtube embed:
182 |
183 | 
184 |
185 | ### xaringan
186 |
187 | Insert a xaringan pull-left and pull-right template.
188 |
189 | 
190 |
191 | Recommended shortcuts (macOS)
192 | -----------------------------
193 |
194 | Here’s a list of recommended shortcuts:
195 |
196 | remedy::remedy_opts$get('hotkeys')
197 | #> backtick bold chunk chunksplit
198 | #> "Ctrl+Cmd+`" "Ctrl+Cmd+B" "Ctrl+Alt+Cmd+C" "Ctrl+Shift+Alt+C"
199 | #> chunkname footnote h1 h2
200 | #> "Ctrl+Shift+Alt+N" "Ctrl+Cmd+Shift+6" "Ctrl+Cmd+1" "Ctrl+Cmd+2"
201 | #> h3 h4 h5 h6
202 | #> "Ctrl+Cmd+3" "Ctrl+Cmd+4" "Ctrl+Cmd+5" "Ctrl+Cmd+6"
203 | #> htmlcomment image italics latex
204 | #> "Ctrl+Alt+C" "Ctrl+Cmd+P" "Ctrl+Cmd+I" "Ctrl+Cmd+L"
205 | #> list right strike table
206 | #> "Ctrl+Shift+Cmd+=" "Alt+Cmd+Right" "Ctrl+Cmd+S" "Ctrl+Cmd+T"
207 | #> url xaringan youtube
208 | #> "Ctrl+Cmd+U" "Ctrl+Cmd+X" "Ctrl+Cmd+Y"
209 |
210 | ### Managing Shortcuts
211 |
212 | Use the [`{rsam}`](https://github.com/yonicd/rsam) package to set and
213 | manage for you the hotkey settings of `{remedy}`.
214 |
215 | If you want to edit the default settings you can view the defaults
216 | `remedy_opts$get('hotkeys')` and change them through
217 | `remedy_opts$set(hotkeys=)`.
218 |
219 | hotkeys <- remedy::remedy_opts$get("hotkeys")
220 | rsam::set_shortcut(sprintf('remedy::%sr',names(hotkeys)), hotkeys)
221 |
222 | Feedback and enhancement
223 | ------------------------
224 |
225 | You’ve found a bug, or have an enhancement idea? Feel free to open an
226 | issue : .
227 |
228 | Code of conduct
229 | ---------------
230 |
231 | Please note that the ‘remedy’ project is released with a [Contributor
232 | Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project,
233 | you agree to abide by its terms.
234 |
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | template:
2 | package: thinkrtemplate
3 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | comment: false
2 |
3 | coverage:
4 | status:
5 | project:
6 | default:
7 | target: auto
8 | threshold: 1%
9 | patch:
10 | default:
11 | target: auto
12 | threshold: 1%
13 |
--------------------------------------------------------------------------------
/contributing.md:
--------------------------------------------------------------------------------
1 | Hey, thank you for your contribution to {remedy}.
2 |
3 | ----
4 |
5 | ## You're opening an issue
6 |
7 | ### Feature request
8 |
9 | Be sure to be as precise as possible describing what you would like to implement. Suggestion for a function would be very appreciated.
10 |
11 | ### You've found a bug
12 |
13 | Please describe as precisely as possible the bug you have encountered.
14 |
15 | ----
16 |
17 | ## You're opening a Pull Request
18 |
19 | Thanks a lot for your contribution!
20 |
21 | Before opening a Pull Request, be sure that:
22 |
23 | + [ ] binding functions have a trailing `r` (for example `listr()` or `urlr()`)
24 |
25 | + [ ] documentation contain example (CRAN forces examples for the addins)
26 |
27 | Example roxygen2 header
28 |
29 | ```r
30 | #' @title Imager
31 | #'
32 | #' @description Convert the selected path into an embedded image
33 | #'
34 | #'
35 | #' @return a markdown image link
36 | #' @export
37 | #' @importFrom rstudioapi getSourceEditorContext modifyRange
38 | #'
39 | #' @examples
40 | #' \dontrun{
41 | #' remedy_example(
42 | #' c( "https://thinkr.fr/wp-content/uploads/2015/03/thinkR1.png"),
43 | #' imager
44 | #' )
45 | #' }
46 | imager <- function() {
47 | ```
48 |
49 | + [ ] you've updated the binding field in addins.dcf
50 |
51 | + [ ] you've added element to hotkey field in [opts.R](https://github.com/ThinkR-open/remedy/blob/master/R/opts.R#L78). Name of element function name without the trailing `r`.
52 |
53 | + [ ] you've added suggested hotkey for macOS, this is for when end users add hotkeys in bulk and use `remedy::remedy_opts$get("hotkeys")`
54 |
55 | + [ ] you've added unit tests in testthat
56 |
57 | + [ ] you've run covrpage `covrpage::covrpage(update_badge = TRUE,vignette = TRUE)` locally since ci can't run the unit tests for addins.
58 |
--------------------------------------------------------------------------------
/data-raw/devtools.R:
--------------------------------------------------------------------------------
1 | # devtools
2 |
3 | devtools::use_data_raw()
4 | devtools::use_code_of_conduct()
5 | devtools::use_mit_license()
6 | devtools::use_news_md()
7 | devtools::use_readme_rmd()
8 | devtools::use_package("rstudioapi")
9 | devtools::use_package("stringr")
10 |
11 | devtools::document()
12 | devtools::build_vignettes()
13 | pkgdown::build_site()
14 |
--------------------------------------------------------------------------------
/inst/rstudio/addins.dcf:
--------------------------------------------------------------------------------
1 | Name: Align
2 | Description: Align <- in selection
3 | Binding: align_arrow
4 | Interactive: false
5 |
6 | Name: AlignEqual
7 | Description: Align = in selection
8 | Binding: align_equal
9 | Interactive: false
10 |
11 | Name: Backtick
12 | Description: Backtick selected word(s)
13 | Binding: backtickr
14 | Interactive: false
15 |
16 | Name: Blockquote
17 | Description: Convert selected text into a blockquote
18 | Binding: blockquoter
19 | Interactive: false
20 |
21 | Name: Bold
22 | Description: Embolden selected text
23 | Binding: boldr
24 | Interactive: false
25 |
26 | Name: Chunk
27 | Description: Chunk script or file
28 | Binding: chunkr
29 | Interactive: false
30 |
31 | Name: Chunksplit
32 | Description: Split chunk into two chunks
33 | Binding: chunksplitr
34 | Interactive: false
35 |
36 | Name: Chunkname
37 | Description: Name unnamed chunks in bulk
38 | Binding: chunknamer
39 | Interactive: false
40 |
41 | Name: Fig Ref
42 | Description: Create a Markdown Figure cross-reference
43 | Binding: fig_ref
44 | Interactive: false
45 |
46 | Name: Footnote
47 | Description: Convert selected text into a footnote
48 | Binding: footnoter
49 | Interactive: false
50 |
51 | Name: H1
52 | Description: Convert selected text into an h1 header
53 | Binding: h1r
54 | Interactive: false
55 |
56 | Name: H2
57 | Description: Convert selected text into an h2 header
58 | Binding: h2r
59 | Interactive: false
60 |
61 | Name: H3
62 | Description: Convert selected text into an h3 header
63 | Binding: h3r
64 | Interactive: false
65 |
66 | Name: H4
67 | Description: Convert selected text into an h4 header
68 | Binding: h4r
69 | Interactive: false
70 |
71 | Name: H5
72 | Description: Convert selected text into an h5 header
73 | Binding: h5r
74 | Interactive: false
75 |
76 | Name: H6
77 | Description: Convert selected text into an h6 header
78 | Binding: h6r
79 | Interactive: false
80 |
81 | Name: Htmlcomment
82 | Description: Convert selected text into an HTML comment or insert new comment
83 | Binding: htmlcommentr
84 | Interactive: false
85 |
86 | Name: ID Ref
87 | Description: Create a Markdown ID cross-reference
88 | Binding: id_ref
89 | Interactive: false
90 |
91 | Name: Image
92 | Description: Convert selected path into an embedded image
93 | Binding: imager
94 | Interactive: false
95 |
96 | Name: Italics
97 | Description: Italicize selected text
98 | Binding: italicsr
99 | Interactive: false
100 |
101 | Name: LaTeX
102 | Description: Convert the selected text in inline LaTeX.
103 | Binding: latexr
104 | Interactive: false
105 |
106 | Name: List (ordered)
107 | Description: Convert selected text into an ordered list
108 | Binding: olistr
109 | Interactive: false
110 |
111 | Name: List (unordered)
112 | Description: Convert selected text into an unordered list
113 | Binding: listr
114 | Interactive: false
115 |
116 | Name: Right
117 | Description: Copy selected text (or line) to the right
118 | Binding: rightr
119 | Interactive: false
120 |
121 | Name: Strike
122 | Description: Strikethrough selected text
123 | Binding: striker
124 | Interactive: false
125 |
126 | Name: Table
127 | Description: Insert a markdown table
128 | Binding: tabler
129 | Interactive: false
130 |
131 | Name: Table Ref
132 | Description: Create a Markdown Figure cross-reference
133 | Binding: tab_ref
134 | Interactive: false
135 |
136 | Name: Url
137 | Description: Convert selected text into a url
138 | Binding: urlr
139 | Interactive: false
140 |
141 | Name: Xaringan
142 | Description: xaringan pull left and pull right
143 | Binding: xaringanr
144 | Interactive: false
145 |
146 | Name: Youtube
147 | Description: Convert selected text into a markdown youtube frame
148 | Binding: youtuber
149 | Interactive: false
150 |
--------------------------------------------------------------------------------
/man/align_arrow.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/align.R
3 | \name{align_arrow}
4 | \alias{align_arrow}
5 | \title{Align a highlighted region's assignment operators.}
6 | \usage{
7 | align_arrow()
8 | }
9 | \value{
10 | Aligns the single assignment operators (\code{<-}) within a highlighted region.
11 | }
12 | \description{
13 | Align a highlighted region's assignment operators.
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | c( "# Align arrows",
19 | "a <- 12",
20 | "aaa <- 13"),
21 | align_arrow
22 | )
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/man/align_equal.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/align.R
3 | \name{align_equal}
4 | \alias{align_equal}
5 | \title{Align a highlighted region's assignment operators.}
6 | \usage{
7 | align_equal()
8 | }
9 | \value{
10 | Aligns the equal sign assignment operators (\code{=}) within a
11 | highlighted region.
12 | }
13 | \description{
14 | Align a highlighted region's assignment operators.
15 | }
16 | \examples{
17 | \dontrun{
18 | remedy_example(
19 | c( "# Align equal signs",
20 | "a = 12",
21 | "aaa = 13"),
22 | align_equal
23 | )
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/man/backtickr.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/backtickr.R
3 | \name{backtickr}
4 | \alias{backtickr}
5 | \title{Backtick}
6 | \usage{
7 | backtickr()
8 | }
9 | \value{
10 | a backticked text selection
11 | }
12 | \description{
13 | Backtick selected word(s)
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | c( "to_backtick"),
19 | backtickr
20 | )
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/man/blockquoter.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/blockquoter.R
3 | \name{blockquoter}
4 | \alias{blockquoter}
5 | \title{Convert to blockquote}
6 | \usage{
7 | blockquoter()
8 | }
9 | \value{
10 | a markdown blockquote
11 | }
12 | \description{
13 | Turn the selected text into a blockquote.
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | c( "to_blockquote"),
19 | blockquoter
20 | )
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/man/chunknamer.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/chunknamer.R
3 | \name{chunknamer}
4 | \alias{chunknamer}
5 | \title{Interactively Add Names to Chunks}
6 | \usage{
7 | chunknamer()
8 | }
9 | \description{
10 | Addin that add in bulk a names to unnamed chunks in a
11 | Rmarkdown document in the source editor.
12 | }
13 | \details{
14 | By default the addin will use "remedy" as the stem of the chunk names. this an be changed using
15 | \code{\link{remedy_opts}}$set(name='ANOTHER NAME'). The names are then added in sequential order using
16 | an %02d naming scheme.
17 | }
18 |
--------------------------------------------------------------------------------
/man/chunkr.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/chunkr.R
3 | \name{chunkr}
4 | \alias{chunkr}
5 | \alias{chunkr_doc}
6 | \alias{chunkr_section}
7 | \title{Interactively Create Rmarkdown Chunks}
8 | \usage{
9 | chunkr()
10 |
11 | chunkr_doc()
12 |
13 | chunkr_section()
14 | }
15 | \description{
16 | Addin that splits full documents into Rmarkdown chunks or
17 | wraps highlighted text in an active RStudio document editor in a Rmarkdown chunk.
18 | }
19 | \details{
20 | Setting \code{\link{remedy_opts}}$set(list(full_doc=TRUE)) chunkr will convert entire document by
21 | \code{\link{remedy_opts}}$get('token_purl'). The default token is the output from a \code{\link[knitr]{purl}}
22 | conversion (## ----chunk name,chunk options----).
23 |
24 | Setting \code{\link{remedy_opts}}$set(list(full_doc=FALSE)), user highlights text and chunkr will
25 | wrap a new Rmarkdown chunk around it, utilizing the other options in \code{\link{remedy_opts}}.
26 | }
27 | \examples{
28 | \dontrun{
29 | remedy_example(
30 | c( "# Create a chunk",
31 | "a <- 12",
32 | "aaa <- 13"),
33 | chunkr
34 | )
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/man/chunksplitr.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/chunksplitr.R
3 | \name{chunksplitr}
4 | \alias{chunksplitr}
5 | \title{Split Chunk}
6 | \usage{
7 | chunksplitr()
8 | }
9 | \description{
10 | Split a chunk into two chunks
11 | }
12 | \details{
13 | Will split below row of the current cursor position or under the highlighted text.
14 | }
15 |
--------------------------------------------------------------------------------
/man/emphasize.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/emphasize.R
3 | \name{italicsr}
4 | \alias{italicsr}
5 | \alias{boldr}
6 | \alias{striker}
7 | \title{Emphasize}
8 | \usage{
9 | italicsr()
10 |
11 | boldr()
12 |
13 | striker()
14 | }
15 | \value{
16 | emboldened, italicized or strikethrough text (in markdown)
17 | }
18 | \description{
19 | Emphasize the selected text.
20 | }
21 | \examples{
22 | \dontrun{
23 | remedy_example(
24 | c( "to_italic"),
25 | italicsr
26 | )
27 | remedy_example(
28 | c( "to_bold"),
29 | boldr
30 | )
31 | remedy_example(
32 | c( "to_strike"),
33 | striker
34 | )
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/man/footnote.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/footnoter.R
3 | \name{footnoter}
4 | \alias{footnoter}
5 | \title{Footnote}
6 | \usage{
7 | footnoter()
8 | }
9 | \value{
10 | footnote text (in markdown)
11 | }
12 | \description{
13 | Create a footnote from selected text.
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | c( "# Create a footnote"),
19 | footnoter
20 | )
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/man/header.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/headr.R
3 | \name{h1r}
4 | \alias{h1r}
5 | \alias{h2r}
6 | \alias{h3r}
7 | \alias{h4r}
8 | \alias{h5r}
9 | \alias{h6r}
10 | \title{Convert to header}
11 | \usage{
12 | h1r()
13 |
14 | h2r()
15 |
16 | h3r()
17 |
18 | h4r()
19 |
20 | h5r()
21 |
22 | h6r()
23 | }
24 | \value{
25 | a markdown header
26 | }
27 | \description{
28 | Convert selected text into a header.
29 | }
30 | \examples{
31 | \dontrun{
32 | remedy_example( c( "h1"), h1r)
33 | remedy_example( c( "h2"), h2r)
34 | remedy_example( c( "h3"), h3r)
35 | remedy_example( c( "h4"), h4r)
36 | remedy_example( c( "h5"), h5r)
37 | remedy_example( c( "h6"), h6r)
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/man/htmlcommentr.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/htmlcommentr.R
3 | \name{htmlcommentr}
4 | \alias{htmlcommentr}
5 | \title{html commenting}
6 | \usage{
7 | htmlcommentr()
8 | }
9 | \description{
10 | RStudio addin to add/remove html comments to highlighted text
11 | }
12 | \details{
13 | Highlighting text will add html comment tags around it
14 |
15 | Highlighting commented text will remove tags.
16 |
17 | \strong{Highlighting}
18 |
19 | Something COMMENT Something
20 |
21 | Something Something
22 |
23 | \strong{New Comment}
24 |
25 | Something COMMENT [cursor here] Something
26 |
27 | Something COMMENT Something
28 |
29 | \strong{Start of Row}
30 |
31 | [cursor here] Something COMMENT Something
32 |
33 |
34 |
35 | \strong{Highlighting Multiple rows}
36 |
37 | Something COMMENT Something
38 |
39 | Something COMMENT Something
40 |
41 |
44 | }
45 | \examples{
46 | \dontrun{
47 | remedy_example( c( "This is bold"), htmlcommentr)
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/man/imager.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/imager.R
3 | \name{imager}
4 | \alias{imager}
5 | \title{Imager}
6 | \usage{
7 | imager()
8 | }
9 | \value{
10 | a markdown image link
11 | }
12 | \description{
13 | Convert the selected path into an embedded image
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | c( "https://thinkr.fr/wp-content/uploads/2015/03/thinkR1.png"),
19 | imager
20 | )
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/man/is_link.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils.R
3 | \name{is_link}
4 | \alias{is_link}
5 | \title{Check if text is a relative link or URL}
6 | \usage{
7 | is_link(text)
8 | }
9 | \arguments{
10 | \item{text}{A character string}
11 | }
12 | \value{
13 | TRUE or FALSE
14 | }
15 | \description{
16 | Check if text is a relative link or URL
17 | }
18 | \examples{
19 | is_link("www.google.com")
20 | is_link("figs/plot.png")
21 | }
22 |
--------------------------------------------------------------------------------
/man/latex.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/latexr.R
3 | \name{latexr}
4 | \alias{latexr}
5 | \title{LaTeX}
6 | \usage{
7 | latexr()
8 | }
9 | \value{
10 | inline LaTeX text (in markdown)
11 | }
12 | \description{
13 | Convert the selected text in inline LaTeX.
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | c( "Latex stuffs"),
19 | latexr
20 | )
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/man/listr.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/listr.R
3 | \name{listr}
4 | \alias{listr}
5 | \alias{olistr}
6 | \title{Convert to list}
7 | \usage{
8 | listr()
9 |
10 | olistr()
11 | }
12 | \value{
13 | \code{listr()} returns an unordered markdown list
14 |
15 | \code{olistr()} returns an ordered markdown list
16 | }
17 | \description{
18 | Convert selected text into an (un)ordered list.
19 | }
20 | \examples{
21 | \dontrun{
22 | #unordered list
23 | remedy_example(c('line 1','line 2'),listr)
24 |
25 | #ordered list
26 | remedy_example(c('line 1','line 2'),olistr)
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/man/move.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mover.R
3 | \name{rightr}
4 | \alias{rightr}
5 | \title{Mover}
6 | \usage{
7 | rightr()
8 | }
9 | \value{
10 | a clone of the line
11 | }
12 | \description{
13 | Copy a selected text or the current line to the right
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | c( "I like to move it "),
19 | rightr
20 | )
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/man/ref.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/referr.R
3 | \name{id_ref}
4 | \alias{id_ref}
5 | \title{urlr}
6 | \usage{
7 | id_ref()
8 | }
9 | \value{
10 | A referenced content
11 | }
12 | \description{
13 | Convert selected text into a markdown ref.
14 | }
15 | \note{
16 | Only the three most common reference types are implemented: id, fig, and tab.
17 | }
18 | \examples{
19 | \dontrun{
20 | remedy_example(
21 | "pouet",
22 | id_ref
23 | )
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/man/remedy-package.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/remedy-package.R
3 | \docType{package}
4 | \name{remedy-package}
5 | \alias{remedy}
6 | \alias{remedy-package}
7 | \title{remedy: 'RStudio' Addins to Simplify 'Markdown' Writing}
8 | \description{
9 | An 'RStudio' addin providing shortcuts for writing in 'Markdown'. This package provides a series of
10 | functions that allow the user to be more efficient when using 'Markdown'. For example, you can select
11 | a word, and put it in bold or in italics, or change the alignment of elements inside you Rmd. The idea
12 | is to map all the functionalities from 'remedy' on keyboard shortcuts, so that it provides an interface
13 | close to what you can find in any other text editor.
14 | }
15 | \seealso{
16 | Useful links:
17 | \itemize{
18 | \item \url{https://github.com/ThinkR-open/remedy}
19 | \item Report bugs at \url{https://github.com/ThinkR-open/remedy/issues}
20 | }
21 |
22 | }
23 | \author{
24 | \strong{Maintainer}: Colin Fay \email{contact@colinfay.me} (0000-0001-7343-1846)
25 |
26 | Authors:
27 | \itemize{
28 | \item Jonathan Sidi \email{yonicd@gmail.com} (0000-0002-4222-1819)
29 | \item Luke Smith \email{luke@protocolvital.info} (author of seasmith/AlignAssign)
30 | }
31 |
32 | Other contributors:
33 | \itemize{
34 | \item Jonathan Carroll \email{rpkg@jcarroll.com.au} (0000-0002-1404-5264) [contributor]
35 | \item Andrzej Oleś \email{andrzej.oles@gmail.com} (0000-0003-0285-2787) [contributor]
36 | \item Daniel Possenriede \email{possenriede@gmail.com} (0000-0002-6738-9845) [contributor]
37 | \item ThinkR [copyright holder]
38 | }
39 |
40 | }
41 | \keyword{internal}
42 |
--------------------------------------------------------------------------------
/man/remedyOpts.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/opts.R
3 | \docType{data}
4 | \name{remedy_opts}
5 | \alias{remedy_opts}
6 | \alias{remedy_opts_current}
7 | \title{Default and current remedy options}
8 | \format{
9 | An object of class \code{list} of length 5.
10 |
11 | An object of class \code{list} of length 5.
12 | }
13 | \usage{
14 | remedy_opts
15 |
16 | remedy_opts_current
17 | }
18 | \description{
19 | Options for functions in the remedy package. When running R code, the object \code{remedy_opts}
20 | (default options) is not modified by chunk headers (local chunk options are
21 | merged with default options), whereas \code{remedy_opts_current} (current options)
22 | changes with different chunk headers and it always reflects the options for
23 | the current chunk.
24 |
25 | Normally we set up the global options once in the first code chunk in a
26 | document using \code{remedy_opts$set()}, so that all \emph{latter} chunks will
27 | use these options. Note the global options set in one chunk will not affect
28 | the options in this chunk itself, and that is why we often need to set global
29 | options in a separate chunk.
30 |
31 | Below is a list of default chunk options, retrieved via
32 | \code{remedy_opts$get()}:
33 | }
34 | \note{
35 | \code{remedy_opts_current} is read-only in the sense that it does nothing if
36 | you call \code{remedy_opts_current$set()}; you can only query the options via
37 | \code{remedy_opts_current$get()}.
38 | }
39 | \examples{
40 | remedy_opts$get()
41 | }
42 | \keyword{datasets}
43 |
--------------------------------------------------------------------------------
/man/remedy_example.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/example_utils.R
3 | \name{remedy_example}
4 | \alias{remedy_example}
5 | \alias{scratch_file}
6 | \alias{entire_document}
7 | \alias{individual_lines}
8 | \alias{set_text}
9 | \title{Functions to run examples and tests}
10 | \usage{
11 | remedy_example(txt, addin, mark = entire_document)
12 |
13 | scratch_file()
14 |
15 | entire_document()
16 |
17 | individual_lines()
18 |
19 | set_text(txt = "", sec, mark)
20 | }
21 | \arguments{
22 | \item{txt}{character, text to place in temporary document}
23 |
24 | \item{addin}{function, addin function to deploy}
25 |
26 | \item{mark}{function, highlight using entire_document or individual_lines}
27 |
28 | \item{sec}{source editor context object}
29 | }
30 | \value{
31 | New document in source editor of RStudio
32 | }
33 | \description{
34 | Utility functions to deploy functions and tests for addins
35 | }
36 | \details{
37 | These function only will work in a RStudio IDE
38 | }
39 |
--------------------------------------------------------------------------------
/man/tabler.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/tabler.R
3 | \name{tabler}
4 | \alias{tabler}
5 | \title{Tabler}
6 | \usage{
7 | tabler()
8 | }
9 | \value{
10 | a markdown table
11 | }
12 | \description{
13 | Insert a table in your file.
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | "head(iris)",
19 | tabler
20 | )
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/man/urlr.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/urlr.R
3 | \name{urlr}
4 | \alias{urlr}
5 | \title{urlr}
6 | \usage{
7 | urlr()
8 | }
9 | \value{
10 | a markdown link
11 | }
12 | \description{
13 | Convert selected text into a link
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | "https://www.thinkr.fr",
19 | urlr
20 | )
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/man/xaringanr.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/xaringan.R
3 | \name{xaringanr}
4 | \alias{xaringanr}
5 | \title{xaringan}
6 | \usage{
7 | xaringanr()
8 | }
9 | \value{
10 | a template for xaringan pull left and right
11 | }
12 | \description{
13 | xaringan pull left and pull right
14 | }
15 | \examples{
16 | \dontrun{
17 | remedy_example(
18 | "",
19 | xaringanr
20 | )
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/man/youtuber.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/youtuber.R
3 | \name{youtuber}
4 | \alias{youtuber}
5 | \title{Addin to create markdown youtube links}
6 | \usage{
7 | youtuber()
8 | }
9 | \description{
10 | Highlight youtube link in source editor and it will be converted
11 | to a markdown link with an image saved in youtube.
12 | }
13 | \details{
14 | if remedy_opts$get('youtube_output')=='md' then the output will be of the form
15 |
16 | [](Link to Video). (useful for github readme)
17 |
18 | if remedy_opts$get('youtube_output')=='html' then the output will be of the form
19 |
20 |
22 |
23 | Default Settings:
24 |
25 | remedy_opts$get('youtube_output'): str(remedy::remedy_opts$get('youtube_output'))
26 |
27 | remedy_opts$get('youtube_height'): str(remedy::remedy_opts$get('youtube_height'))
28 |
29 | remedy_opts$get('youtube_width'): str(remedy::remedy_opts$get('youtube_width'))
30 | }
31 | \examples{
32 | \dontrun{
33 | remedy_example(
34 | "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
35 | youtuber
36 | )
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/reference/figures/align.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/align.gif
--------------------------------------------------------------------------------
/reference/figures/alignequal.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/alignequal.gif
--------------------------------------------------------------------------------
/reference/figures/backtick.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/backtick.gif
--------------------------------------------------------------------------------
/reference/figures/blockquote.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/blockquote.gif
--------------------------------------------------------------------------------
/reference/figures/chunck.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/chunck.gif
--------------------------------------------------------------------------------
/reference/figures/chunk.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/chunk.gif
--------------------------------------------------------------------------------
/reference/figures/chunksplit.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/chunksplit.gif
--------------------------------------------------------------------------------
/reference/figures/cross-ref.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/cross-ref.gif
--------------------------------------------------------------------------------
/reference/figures/down.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/down.gif
--------------------------------------------------------------------------------
/reference/figures/emphasise.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/emphasise.gif
--------------------------------------------------------------------------------
/reference/figures/footnote.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/footnote.gif
--------------------------------------------------------------------------------
/reference/figures/header.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/header.gif
--------------------------------------------------------------------------------
/reference/figures/htmlcomment.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/htmlcomment.gif
--------------------------------------------------------------------------------
/reference/figures/image.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/image.gif
--------------------------------------------------------------------------------
/reference/figures/latex.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/latex.gif
--------------------------------------------------------------------------------
/reference/figures/list.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/list.gif
--------------------------------------------------------------------------------
/reference/figures/remedy_example.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/remedy_example.gif
--------------------------------------------------------------------------------
/reference/figures/right.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/right.gif
--------------------------------------------------------------------------------
/reference/figures/table.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/table.gif
--------------------------------------------------------------------------------
/reference/figures/table_remedy.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/table_remedy.gif
--------------------------------------------------------------------------------
/reference/figures/thinkr-hex-remedy-favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/thinkr-hex-remedy-favicon.ico
--------------------------------------------------------------------------------
/reference/figures/thinkr-hex-remedy-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/thinkr-hex-remedy-small.png
--------------------------------------------------------------------------------
/reference/figures/thinkr-hex-remedy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/thinkr-hex-remedy.png
--------------------------------------------------------------------------------
/reference/figures/url.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/url.gif
--------------------------------------------------------------------------------
/reference/figures/xaringan.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/xaringan.gif
--------------------------------------------------------------------------------
/reference/figures/youtube.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThinkR-open/remedy/eb8fbdd606d9b106c1aed6b5d30908b8c8ae7e4f/reference/figures/youtube.gif
--------------------------------------------------------------------------------
/remedy.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: No
4 | SaveWorkspace: No
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
15 | BuildType: Package
16 | PackageUseDevtools: Yes
17 | PackageInstallArgs: --no-multiarch --with-keep.source
18 | PackageRoxygenize: rd,collate,namespace,vignette
19 |
--------------------------------------------------------------------------------
/tests/README.md:
--------------------------------------------------------------------------------
1 | Tests and Coverage
2 | ================
3 | 21 December, 2018 11:12:46
4 |
5 | This output is created by
6 | [covrpage](https://github.com/yonicd/covrpage).
7 |
8 | ## Coverage
9 |
10 | Coverage summary is created using the
11 | [covr](https://github.com/r-lib/covr) package.
12 |
13 | | Object | Coverage (%) |
14 | | :----------------------------------------- | :----------: |
15 | | remedy | 0.8 |
16 | | [R/align.R](../R/align.R) | 0.0 |
17 | | [R/backtickr.R](../R/backtickr.R) | 0.0 |
18 | | [R/blockquoter.R](../R/blockquoter.R) | 0.0 |
19 | | [R/chunknamer.R](../R/chunknamer.R) | 0.0 |
20 | | [R/chunkr.R](../R/chunkr.R) | 0.0 |
21 | | [R/chunksplitr.R](../R/chunksplitr.R) | 0.0 |
22 | | [R/emphasize.R](../R/emphasize.R) | 0.0 |
23 | | [R/footnoter.R](../R/footnoter.R) | 0.0 |
24 | | [R/headr.R](../R/headr.R) | 0.0 |
25 | | [R/htmlcommentr.R](../R/htmlcommentr.R) | 0.0 |
26 | | [R/imager.R](../R/imager.R) | 0.0 |
27 | | [R/internal.R](../R/internal.R) | 0.0 |
28 | | [R/latexr.R](../R/latexr.R) | 0.0 |
29 | | [R/listr.R](../R/listr.R) | 0.0 |
30 | | [R/mover.R](../R/mover.R) | 0.0 |
31 | | [R/opts\_complete.R](../R/opts_complete.R) | 0.0 |
32 | | [R/opts.R](../R/opts.R) | 0.0 |
33 | | [R/tabler.R](../R/tabler.R) | 0.0 |
34 | | [R/urlr.R](../R/urlr.R) | 0.0 |
35 | | [R/xaringan.R](../R/xaringan.R) | 0.0 |
36 | | [R/youtuber.R](../R/youtuber.R) | 0.0 |
37 | | [R/example\_utils.R](../R/example_utils.R) | 3.7 |
38 | | [R/utils.R](../R/utils.R) | 25.0 |
39 |
40 |
41 |
42 | ## Unit Tests
43 |
44 | Unit Test summary is created using the
45 | [testthat](https://github.com/r-lib/testthat)
46 | package.
47 |
48 | | file | n | time | error | failed | skipped | warning |
49 | | :----------------------------------------------------------- | -: | ----: | ----: | -----: | ------: | ------: |
50 | | [test-backtick.R](testthat/test-backtick.R) | 4 | 1.194 | 0 | 0 | 0 | 0 |
51 | | [test-blockquote.R](testthat/test-blockquote.R) | 4 | 1.179 | 0 | 0 | 0 | 0 |
52 | | [test-chunk.R](testthat/test-chunk.R) | 4 | 1.266 | 0 | 0 | 0 | 0 |
53 | | [test-chunknamer.R](testthat/test-chunknamer.R) | 4 | 1.341 | 0 | 0 | 0 | 0 |
54 | | [test-emphasizers.R](testthat/test-emphasizers.R) | 6 | 1.532 | 0 | 0 | 0 | 0 |
55 | | [test-enclose.R](testthat/test-enclose.R) | 4 | 1.174 | 0 | 0 | 0 | 0 |
56 | | [test-footnote.R](testthat/test-footnote.R) | 4 | 1.182 | 0 | 0 | 0 | 0 |
57 | | [test-headr.R](testthat/test-headr.R) | 7 | 1.440 | 0 | 0 | 0 | 0 |
58 | | [test-image.R](testthat/test-image.R) | 6 | 1.847 | 0 | 0 | 0 | 0 |
59 | | [test-latex.R](testthat/test-latex.R) | 4 | 1.266 | 0 | 0 | 0 | 0 |
60 | | [test-link.R](testthat/test-link.R) | 16 | 0.018 | 0 | 0 | 0 | 0 |
61 | | [test-list.R](testthat/test-list.R) | 11 | 3.285 | 0 | 0 | 0 | 0 |
62 | | [test-multiline\_prefix.R](testthat/test-multiline_prefix.R) | 7 | 2.044 | 0 | 0 | 0 | 0 |
63 | | [test-prefix.R](testthat/test-prefix.R) | 5 | 1.547 | 0 | 0 | 0 | 0 |
64 | | [test-right.R](testthat/test-right.R) | 4 | 1.311 | 0 | 0 | 0 | 0 |
65 | | [test-url.R](testthat/test-url.R) | 6 | 1.866 | 0 | 0 | 0 | 0 |
66 | | [test-xaringan.R](testthat/test-xaringan.R) | 2 | 0.497 | 0 | 0 | 0 | 0 |
67 | | [test-youtube.R](testthat/test-youtube.R) | 4 | 1.191 | 0 | 0 | 0 | 0 |
68 |
69 |
70 |
71 | Show Detailed Test Results
72 |
73 |
74 | | file | context | test | status | n | time |
75 | | :---------------------------------------------------------------- | :------------------------------ | :--------------------------------------------------------- | :----- | -: | ----: |
76 | | [test-backtick.R](testthat/test-backtick.R#L17) | backticks | backticks: empty | PASS | 1 | 0.201 |
77 | | [test-backtick.R](testthat/test-backtick.R#L30) | backticks | backticks: highlighted | PASS | 1 | 0.319 |
78 | | [test-backtick.R](testthat/test-backtick.R#L43) | backticks | backticks: multiline | PASS | 1 | 0.330 |
79 | | [test-backtick.R](testthat/test-backtick.R#L56) | backticks | backticks: multiselect | PASS | 1 | 0.344 |
80 | | [test-blockquote.R](testthat/test-blockquote.R#L14) | blockquoter | blockquoter: empty | PASS | 1 | 0.189 |
81 | | [test-blockquote.R](testthat/test-blockquote.R#L26) | blockquoter | blockquoter: highlighted | PASS | 1 | 0.320 |
82 | | [test-blockquote.R](testthat/test-blockquote.R#L38) | blockquoter | blockquoter: multiline | PASS | 1 | 0.329 |
83 | | [test-blockquote.R](testthat/test-blockquote.R#L50) | blockquoter | blockquoter: multiparagraph | PASS | 1 | 0.341 |
84 | | [test-chunk.R](testthat/test-chunk.R#L20_L22) | chunks | splitting: splitting one chunk into two | PASS | 1 | 0.329 |
85 | | [test-chunk.R](testthat/test-chunk.R#L43_L45) | chunks | params: splitting one chunk into two carrying chunk params | PASS | 1 | 0.319 |
86 | | [test-chunk.R](testthat/test-chunk.R#L66_L68) | chunks | creating: full document | PASS | 1 | 0.297 |
87 | | [test-chunk.R](testthat/test-chunk.R#L88_L90) | chunks | wrapping: section | PASS | 1 | 0.321 |
88 | | [test-chunknamer.R](testthat/test-chunknamer.R#L18_L22) | chunknamer | splitting: splitting one chunk into two | PASS | 1 | 0.353 |
89 | | [test-chunknamer.R](testthat/test-chunknamer.R#L43_L45) | chunknamer | params: splitting one chunk into two carrying chunk params | PASS | 1 | 0.347 |
90 | | [test-chunknamer.R](testthat/test-chunknamer.R#L66_L68) | chunknamer | creating: full document | PASS | 1 | 0.301 |
91 | | [test-chunknamer.R](testthat/test-chunknamer.R#L88_L90) | chunknamer | wrapping: section | PASS | 1 | 0.340 |
92 | | [test-emphasizers.R](testthat/test-emphasizers.R#L16) | emphasizers | italics: empty | PASS | 1 | 0.179 |
93 | | [test-emphasizers.R](testthat/test-emphasizers.R#L29) | emphasizers | italics: highlighted | PASS | 1 | 0.332 |
94 | | [test-emphasizers.R](testthat/test-emphasizers.R#L47) | emphasizers | bold: empty | PASS | 1 | 0.183 |
95 | | [test-emphasizers.R](testthat/test-emphasizers.R#L60) | emphasizers | bold: highlighted | PASS | 1 | 0.336 |
96 | | [test-emphasizers.R](testthat/test-emphasizers.R#L78) | emphasizers | strike: empty | PASS | 1 | 0.182 |
97 | | [test-emphasizers.R](testthat/test-emphasizers.R#L91) | emphasizers | strike: highlighted | PASS | 1 | 0.320 |
98 | | [test-enclose.R](testthat/test-enclose.R#L22) | enclose | enclose: empty | PASS | 1 | 0.183 |
99 | | [test-enclose.R](testthat/test-enclose.R#L39) | enclose | enclose: highlighted | PASS | 1 | 0.328 |
100 | | [test-enclose.R](testthat/test-enclose.R#L55) | enclose | enclose: multiple lines | PASS | 1 | 0.329 |
101 | | [test-enclose.R](testthat/test-enclose.R#L69) | enclose | enclose: multiple selections | PASS | 1 | 0.334 |
102 | | [test-footnote.R](testthat/test-footnote.R#L16) | footnotes | footnotes: empty | PASS | 1 | 0.188 |
103 | | [test-footnote.R](testthat/test-footnote.R#L29) | footnotes | footnotes: highlighted | PASS | 1 | 0.329 |
104 | | [test-footnote.R](testthat/test-footnote.R#L42) | footnotes | footnotes: multiline | PASS | 1 | 0.329 |
105 | | [test-footnote.R](testthat/test-footnote.R#L55) | footnotes | footnotes: multiselect | PASS | 1 | 0.336 |
106 | | [test-headr.R](testthat/test-headr.R#L12) | headr | add headers to source editor: \# | PASS | 1 | 0.186 |
107 | | [test-headr.R](testthat/test-headr.R#L19) | headr | add headers to source editor: \#\# | PASS | 1 | 0.184 |
108 | | [test-headr.R](testthat/test-headr.R#L26) | headr | add headers to source editor: \#\#\# | PASS | 1 | 0.187 |
109 | | [test-headr.R](testthat/test-headr.R#L33) | headr | add headers to source editor: \#\#\#\# | PASS | 1 | 0.193 |
110 | | [test-headr.R](testthat/test-headr.R#L40) | headr | add headers to source editor: \#\#\#\#\# | PASS | 1 | 0.185 |
111 | | [test-headr.R](testthat/test-headr.R#L47) | headr | add headers to source editor: \#\#\#\#\#\# | PASS | 1 | 0.181 |
112 | | [test-headr.R](testthat/test-headr.R#L55) | headr | add headers to source editor: append | PASS | 1 | 0.324 |
113 | | [test-image.R](testthat/test-image.R#L16) | images | images: empty | PASS | 1 | 0.192 |
114 | | [test-image.R](testthat/test-image.R#L29) | images | images: no description bad link | PASS | 1 | 0.322 |
115 | | [test-image.R](testthat/test-image.R#L42) | images | images: description bad link | PASS | 1 | 0.332 |
116 | | [test-image.R](testthat/test-image.R#L55) | images | images: no description good link | PASS | 1 | 0.335 |
117 | | [test-image.R](testthat/test-image.R#L68) | images | images: single word description good link | PASS | 1 | 0.340 |
118 | | [test-image.R](testthat/test-image.R#L81) | images | images: multiple word description good link | PASS | 1 | 0.326 |
119 | | [test-latex.R](testthat/test-latex.R#L16) | latex | latex: empty | PASS | 1 | 0.197 |
120 | | [test-latex.R](testthat/test-latex.R#L29) | latex | latex: highlighted | PASS | 1 | 0.404 |
121 | | [test-latex.R](testthat/test-latex.R#L42) | latex | latex: multiline | PASS | 1 | 0.324 |
122 | | [test-latex.R](testthat/test-latex.R#L55) | latex | latex: multiselect | PASS | 1 | 0.341 |
123 | | [test-link.R](testthat/test-link.R#L5) | url and relative link detection | urls are detected: www | PASS | 1 | 0.001 |
124 | | [test-link.R](testthat/test-link.R#L8) | url and relative link detection | urls are detected: http | PASS | 1 | 0.002 |
125 | | [test-link.R](testthat/test-link.R#L11) | url and relative link detection | urls are detected: https | PASS | 1 | 0.001 |
126 | | [test-link.R](testthat/test-link.R#L17) | url and relative link detection | (potential) relative links are detected: md | PASS | 1 | 0.001 |
127 | | [test-link.R](testthat/test-link.R#L20) | url and relative link detection | (potential) relative links are detected: Rmd | PASS | 1 | 0.002 |
128 | | [test-link.R](testthat/test-link.R#L23) | url and relative link detection | (potential) relative links are detected: subdir file | PASS | 1 | 0.001 |
129 | | [test-link.R](testthat/test-link.R#L26) | url and relative link detection | (potential) relative links are detected: subdir folder | PASS | 1 | 0.001 |
130 | | [test-link.R](testthat/test-link.R#L32) | url and relative link detection | image links are detected: png | PASS | 1 | 0.001 |
131 | | [test-link.R](testthat/test-link.R#L35) | url and relative link detection | image links are detected: jpg | PASS | 1 | 0.001 |
132 | | [test-link.R](testthat/test-link.R#L38) | url and relative link detection | image links are detected: jpeg | PASS | 1 | 0.001 |
133 | | [test-link.R](testthat/test-link.R#L41) | url and relative link detection | image links are detected: gif | PASS | 1 | 0.001 |
134 | | [test-link.R](testthat/test-link.R#L47) | url and relative link detection | invalid urls/links are not detected: http/s | PASS | 2 | 0.002 |
135 | | [test-link.R](testthat/test-link.R#L51) | url and relative link detection | invalid urls/links are not detected: www | PASS | 2 | 0.002 |
136 | | [test-link.R](testthat/test-link.R#L55) | url and relative link detection | invalid urls/links are not detected: no .com | PASS | 1 | 0.001 |
137 | | [test-list.R](testthat/test-list.R#L14) | lists | unordered lists: empty | PASS | 1 | 0.133 |
138 | | [test-list.R](testthat/test-list.R#L26) | lists | unordered lists: highlighted | PASS | 1 | 0.333 |
139 | | [test-list.R](testthat/test-list.R#L38) | lists | unordered lists: multiple lines | PASS | 1 | 0.337 |
140 | | [test-list.R](testthat/test-list.R#L50) | lists | unordered lists: multiple lines with quote at start | PASS | 1 | 0.334 |
141 | | [test-list.R](testthat/test-list.R#L62) | lists | unordered lists: multiple paragraphs | PASS | 1 | 0.327 |
142 | | [test-list.R](testthat/test-list.R#L74) | lists | unordered lists: nested list | PASS | 1 | 0.347 |
143 | | [test-list.R](testthat/test-list.R#L89) | lists | ordered lists: empty | PASS | 1 | 0.131 |
144 | | [test-list.R](testthat/test-list.R#L101) | lists | ordered lists: highlighted | PASS | 1 | 0.340 |
145 | | [test-list.R](testthat/test-list.R#L113) | lists | ordered lists: multiple lines | PASS | 1 | 0.332 |
146 | | [test-list.R](testthat/test-list.R#L125) | lists | ordered lists: multiple paragraphs | PASS | 1 | 0.337 |
147 | | [test-list.R](testthat/test-list.R#L137) | lists | ordered lists: nested list | PASS | 1 | 0.334 |
148 | | [test-multiline\_prefix.R](testthat/test-multiline_prefix.R#L21) | multiline prefix | prefix: empty | PASS | 1 | 0.129 |
149 | | [test-multiline\_prefix.R](testthat/test-multiline_prefix.R#L33) | multiline prefix | prefix: empty as\_is | PASS | 1 | 0.198 |
150 | | [test-multiline\_prefix.R](testthat/test-multiline_prefix.R#L49) | multiline prefix | prefix: highlighted | PASS | 1 | 0.335 |
151 | | [test-multiline\_prefix.R](testthat/test-multiline_prefix.R#L65) | multiline prefix | prefix: multiple lines | PASS | 1 | 0.350 |
152 | | [test-multiline\_prefix.R](testthat/test-multiline_prefix.R#L81) | multiline prefix | prefix: multiple paragraphs | PASS | 1 | 0.339 |
153 | | [test-multiline\_prefix.R](testthat/test-multiline_prefix.R#L95) | multiline prefix | prefix: multiple paragraphs as\_is | PASS | 1 | 0.345 |
154 | | [test-multiline\_prefix.R](testthat/test-multiline_prefix.R#L111) | multiline prefix | prefix: nested list | PASS | 1 | 0.348 |
155 | | [test-prefix.R](testthat/test-prefix.R#L20) | prefix | prefix: empty | PASS | 1 | 0.195 |
156 | | [test-prefix.R](testthat/test-prefix.R#L36) | prefix | prefix: line | PASS | 1 | 0.340 |
157 | | [test-prefix.R](testthat/test-prefix.R#L50) | prefix | prefix: highlighted | PASS | 1 | 0.329 |
158 | | [test-prefix.R](testthat/test-prefix.R#L66) | prefix | prefix: multiple lines | PASS | 1 | 0.337 |
159 | | [test-prefix.R](testthat/test-prefix.R#L80) | prefix | prefix: multiple selections | PASS | 1 | 0.346 |
160 | | [test-right.R](testthat/test-right.R#L16) | copy text to the right | rightr: one word | PASS | 1 | 0.317 |
161 | | [test-right.R](testthat/test-right.R#L29) | copy text to the right | rightr: one word | PASS | 1 | 0.328 |
162 | | [test-right.R](testthat/test-right.R#L42) | copy text to the right | rightr: multiple words | PASS | 1 | 0.345 |
163 | | [test-right.R](testthat/test-right.R#L60) | copy text to the right | rightr: highlighting | PASS | 1 | 0.321 |
164 | | [test-url.R](testthat/test-url.R#L16) | urls | urls: empty | PASS | 1 | 0.182 |
165 | | [test-url.R](testthat/test-url.R#L29) | urls | urls: no description bad link | PASS | 1 | 0.332 |
166 | | [test-url.R](testthat/test-url.R#L42) | urls | urls: description bad link | PASS | 1 | 0.342 |
167 | | [test-url.R](testthat/test-url.R#L55) | urls | urls: no description good link | PASS | 1 | 0.334 |
168 | | [test-url.R](testthat/test-url.R#L68) | urls | urls: single word description good link | PASS | 1 | 0.337 |
169 | | [test-url.R](testthat/test-url.R#L81) | urls | urls: multiple word description good link | PASS | 1 | 0.339 |
170 | | [test-xaringan.R](testthat/test-xaringan.R#L24_L26) | xaringan | urls: empty | PASS | 1 | 0.177 |
171 | | [test-xaringan.R](testthat/test-xaringan.R#L38_L39) | xaringan | urls: highlighted | PASS | 1 | 0.320 |
172 | | [test-youtube.R](testthat/test-youtube.R#L16_L18) | youtube | images: empty html | PASS | 1 | 0.184 |
173 | | [test-youtube.R](testthat/test-youtube.R#L31_L32) | youtube | images: html | PASS | 1 | 0.336 |
174 | | [test-youtube.R](testthat/test-youtube.R#L46_L47) | youtube | images: html width/height | PASS | 1 | 0.333 |
175 | | [test-youtube.R](testthat/test-youtube.R#L63_L64) | youtube | images: html width/height | PASS | 1 | 0.338 |
176 |
177 |
178 |
179 |
180 |
181 | Session Info
182 |
183 | | Field | Value |
184 | | :------- | :---------------------------------- |
185 | | Version | R version 3.5.1 (2018-07-02) |
186 | | Platform | x86\_64-apple-darwin15.6.0 (64-bit) |
187 | | Running | macOS 10.14.2 |
188 | | Language | en\_US |
189 | | Timezone | America/New\_York |
190 |
191 | | Package | Version |
192 | | :------- | :--------- |
193 | | testthat | 2.0.0.9000 |
194 | | covr | 3.2.0 |
195 | | covrpage | 0.0.68 |
196 |
197 |
198 |
199 |
200 |
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(remedy)
3 |
4 | test_check("remedy")
5 |
--------------------------------------------------------------------------------
/tests/testthat/helper-functions.R:
--------------------------------------------------------------------------------
1 | skip_if_not_rstudio <- function(version = NULL) {
2 | available <- rstudioapi::isAvailable(version)
3 | message <- if (is.null(version))
4 | "RStudio not available"
5 | else
6 | paste("RStudio version '", version, "' not available", sep = "")
7 |
8 | if (!available)
9 | skip(message)
10 |
11 | TRUE
12 | }
13 |
--------------------------------------------------------------------------------
/tests/testthat/test-backtick.R:
--------------------------------------------------------------------------------
1 | testthat::context("backticks")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('backticks',{
6 |
7 | skip_if_not_rstudio()
8 |
9 | testthat::skip_on_travis()
10 |
11 | it('empty',{
12 |
13 | backtickr()
14 |
15 | rstudioapi::documentSave(sec$id)
16 |
17 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'``')
18 |
19 | set_text(sec = sec)
20 | })
21 |
22 | it('highlighted',{
23 |
24 | set_text('some text',sec = sec, mark = entire_document)
25 |
26 | backtickr()
27 |
28 | rstudioapi::documentSave(sec$id)
29 |
30 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'`some text`')
31 |
32 | set_text(sec = sec)
33 | })
34 |
35 | it('multiline',{
36 |
37 | set_text('some text\n more text',sec = sec, mark = entire_document)
38 |
39 | backtickr()
40 |
41 | rstudioapi::documentSave(sec$id)
42 |
43 | testthat::expect_equal(readLines(sec$path, warn = FALSE),c('`some text',' more text`'))
44 |
45 | set_text(sec = sec)
46 | })
47 |
48 | it('multiselect',{
49 |
50 | set_text('some text\n more text',sec = sec, mark = individual_lines)
51 |
52 | backtickr()
53 |
54 | rstudioapi::documentSave(sec$id)
55 |
56 | testthat::expect_equal(readLines(sec$path, warn = FALSE),c('`some text`','` more text`'))
57 |
58 | set_text(sec = sec)
59 | })
60 |
61 | })
62 |
--------------------------------------------------------------------------------
/tests/testthat/test-blockquote.R:
--------------------------------------------------------------------------------
1 | testthat::context("blockquoter")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe("blockquoter", {
6 | skip_if_not_rstudio()
7 | testthat::skip_on_travis()
8 |
9 | it("empty", {
10 | blockquoter()
11 |
12 | rstudioapi::documentSave(sec$id)
13 |
14 | testthat::expect_equal(readLines(sec$path, warn = FALSE), "> ")
15 |
16 | set_text(sec = sec)
17 | })
18 |
19 | it("highlighted", {
20 | set_text("some text", sec = sec, mark = entire_document)
21 |
22 | blockquoter()
23 |
24 | rstudioapi::documentSave(sec$id)
25 |
26 | testthat::expect_equal(readLines(sec$path, warn = FALSE), "> some text")
27 |
28 | set_text(sec = sec)
29 | })
30 |
31 | it("multiline", {
32 | set_text("some text\nmore text", sec = sec, mark = entire_document)
33 |
34 | blockquoter()
35 |
36 | rstudioapi::documentSave(sec$id)
37 |
38 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c("> some text", "> more text"))
39 |
40 | set_text(sec = sec)
41 | })
42 |
43 | it("multiparagraph", {
44 | set_text("some text\n\nmore text", sec = sec, mark = entire_document)
45 |
46 | blockquoter()
47 |
48 | rstudioapi::documentSave(sec$id)
49 |
50 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c("> some text", "> ", "> more text"))
51 |
52 | set_text(sec = sec)
53 | })
54 | })
55 |
--------------------------------------------------------------------------------
/tests/testthat/test-chunk.R:
--------------------------------------------------------------------------------
1 | testthat::context("chunks")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('splitting',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('splitting one chunk into two',{
11 |
12 | set_text(txt = '```{r}\n \n```',sec = sec)
13 |
14 | rstudioapi::setCursorPosition(rstudioapi::document_position(2,1),id = sec$id)
15 |
16 | chunksplitr()
17 |
18 | rstudioapi::documentSave(sec$id)
19 |
20 | testthat::expect_equal(readLines(sec$path,warn = FALSE),
21 | c('```{r}',' ','```',' ','```{r}','```')
22 | )
23 | set_text(sec = sec)
24 | })
25 |
26 | })
27 |
28 | testthat::describe('params',{
29 |
30 | skip_if_not_rstudio()
31 | testthat::skip_on_travis()
32 |
33 | it('splitting one chunk into two carrying chunk params',{
34 |
35 | set_text(txt = '```{r, echo = FALSE, warnings = TRUE}\n \n```',sec = sec)
36 |
37 | rstudioapi::setCursorPosition(rstudioapi::document_position(2,1),id = sec$id)
38 |
39 | chunksplitr()
40 |
41 | rstudioapi::documentSave(sec$id)
42 |
43 | testthat::expect_equal(readLines(sec$path,warn = FALSE),
44 | c('```{r, echo = FALSE, warnings = TRUE}',' ','```',' ','```{r, echo = FALSE, warnings = TRUE}','```')
45 | )
46 | set_text(sec = sec)
47 | })
48 |
49 | })
50 |
51 | testthat::describe('creating',{
52 |
53 | skip_if_not_rstudio()
54 | testthat::skip_on_travis()
55 |
56 | it('full document',{
57 |
58 | set_text(txt = c("## ----aaa----\n\n## ----bbb----"),sec = sec)
59 |
60 | remedy_opts$set(full_doc=TRUE)
61 |
62 | chunkr()
63 |
64 | rstudioapi::documentSave(sec$id)
65 |
66 | testthat::expect_equal(readLines(sec$path,warn = FALSE),
67 | c("```{r aaa}","","```","```{r bbb}","```")
68 | )
69 | set_text(sec = sec)
70 | remedy_opts$set(full_doc=FALSE)
71 | })
72 |
73 | })
74 |
75 | testthat::describe('wrapping',{
76 |
77 | skip_if_not_rstudio()
78 | testthat::skip_on_travis()
79 |
80 | it('section',{
81 |
82 | set_text(txt = 'aaa',sec = sec,mark = entire_document)
83 |
84 | chunkr_section()
85 |
86 | rstudioapi::documentSave(sec$id)
87 |
88 | testthat::expect_equal(readLines(sec$path,warn = FALSE),
89 | c("","```{r remedy001}","aaa","```")
90 | )
91 | set_text(sec = sec)
92 | })
93 |
94 | })
95 |
--------------------------------------------------------------------------------
/tests/testthat/test-chunknamer.R:
--------------------------------------------------------------------------------
1 | testthat::context("chunknamer")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('splitting',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('splitting one chunk into two',{
11 |
12 | set_text(txt = '```{r}\n \n```\n\n```{r}\n \n```\n\n```{r}\n \n```\n\n',sec = sec)
13 | rstudioapi::setCursorPosition(rstudioapi::document_position(2,1),id = sec$id)
14 |
15 | chunknamer()
16 |
17 | rstudioapi::documentSave(sec$id)
18 | testthat::expect_equal(readLines(path,warn = FALSE),
19 | c('```{r remedy01}',' ','```','',
20 | '```{r remedy02}',' ','```','',
21 | '```{r remedy03}',' ','```','')
22 | )
23 | set_text(sec = sec)
24 | })
25 |
26 | })
27 |
28 | testthat::describe('params',{
29 |
30 | skip_if_not_rstudio()
31 | testthat::skip_on_travis()
32 |
33 | it('splitting one chunk into two carrying chunk params',{
34 |
35 | set_text(txt = '```{r, echo = FALSE, warnings = TRUE}\n \n```',sec = sec)
36 |
37 | rstudioapi::setCursorPosition(rstudioapi::document_position(2,1),id = sec$id)
38 |
39 | chunksplitr()
40 |
41 | rstudioapi::documentSave(sec$id)
42 |
43 | testthat::expect_equal(readLines(sec$path,warn = FALSE),
44 | c('```{r, echo = FALSE, warnings = TRUE}',' ','```',' ','```{r, echo = FALSE, warnings = TRUE}','```')
45 | )
46 | set_text(sec = sec)
47 | })
48 |
49 | })
50 |
51 | testthat::describe('creating',{
52 |
53 | skip_if_not_rstudio()
54 | testthat::skip_on_travis()
55 |
56 | it('full document',{
57 |
58 | set_text(txt = c("## ----aaa----\n\n## ----bbb----"),sec = sec)
59 |
60 | remedy_opts$set(full_doc=TRUE)
61 |
62 | chunkr()
63 |
64 | rstudioapi::documentSave(sec$id)
65 |
66 | testthat::expect_equal(readLines(sec$path,warn = FALSE),
67 | c("```{r aaa}","","```","```{r bbb}","```")
68 | )
69 | set_text(sec = sec)
70 | remedy_opts$set(full_doc=FALSE)
71 | })
72 |
73 | })
74 |
75 | testthat::describe('wrapping',{
76 |
77 | skip_if_not_rstudio()
78 | testthat::skip_on_travis()
79 |
80 | it('section',{
81 |
82 | set_text(txt = 'aaa',sec = sec,mark = entire_document)
83 |
84 | chunkr_section()
85 |
86 | rstudioapi::documentSave(sec$id)
87 |
88 | testthat::expect_equal(readLines(sec$path,warn = FALSE),
89 | c("","```{r remedy001}","aaa","```")
90 | )
91 | set_text(sec = sec)
92 | })
93 |
94 | })
95 |
--------------------------------------------------------------------------------
/tests/testthat/test-emphasizers.R:
--------------------------------------------------------------------------------
1 | testthat::context("emphasizers")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('italics',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('empty',{
11 |
12 | italicsr()
13 |
14 | rstudioapi::documentSave(sec$id)
15 |
16 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'__')
17 |
18 | set_text(sec = sec)
19 | })
20 |
21 | it('highlighted',{
22 |
23 | set_text('some text',sec = sec, mark = entire_document)
24 |
25 | italicsr()
26 |
27 | rstudioapi::documentSave(sec$id)
28 |
29 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'_some text_')
30 |
31 | set_text(sec = sec)
32 | })
33 |
34 | })
35 |
36 | testthat::describe('bold',{
37 |
38 | skip_if_not_rstudio()
39 | testthat::skip_on_travis()
40 |
41 | it('empty',{
42 |
43 | boldr()
44 |
45 | rstudioapi::documentSave(sec$id)
46 |
47 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'____')
48 |
49 | set_text(sec = sec)
50 | })
51 |
52 | it('highlighted',{
53 |
54 | set_text('some text',sec = sec, mark = entire_document)
55 |
56 | boldr()
57 |
58 | rstudioapi::documentSave(sec$id)
59 |
60 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'__some text__')
61 |
62 | set_text(sec = sec)
63 | })
64 |
65 | })
66 |
67 | testthat::describe('strike',{
68 |
69 | skip_if_not_rstudio()
70 | testthat::skip_on_travis()
71 |
72 | it('empty',{
73 |
74 | striker()
75 |
76 | rstudioapi::documentSave(sec$id)
77 |
78 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'~~~~')
79 |
80 | set_text(sec = sec)
81 | })
82 |
83 | it('highlighted',{
84 |
85 | set_text('some text',sec = sec, mark = entire_document)
86 |
87 | striker()
88 |
89 | rstudioapi::documentSave(sec$id)
90 |
91 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'~~some text~~')
92 |
93 | set_text(sec = sec)
94 | })
95 |
96 | })
--------------------------------------------------------------------------------
/tests/testthat/test-enclose.R:
--------------------------------------------------------------------------------
1 | testthat::context("enclose")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('enclose', {
6 | skip_if_not_rstudio()
7 | testthat::skip_on_travis()
8 |
9 | enclose <- remedy:::enclose
10 |
11 | before <- 'a '
12 | after <- ' z'
13 |
14 | it('empty',{
15 |
16 | res <- paste0(before, after)
17 |
18 | enclose(before, after)
19 |
20 | rstudioapi::documentSave(sec$id)
21 |
22 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
23 |
24 | set_text(sec = sec)
25 | })
26 |
27 | txt <- 'some text'
28 |
29 | it('highlighted', {
30 |
31 | res <- paste0(before, txt, after)
32 |
33 | set_text(txt, sec = sec, mark = entire_document)
34 |
35 | enclose(before, after)
36 |
37 | rstudioapi::documentSave(sec$id)
38 |
39 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
40 |
41 | set_text(sec = sec)
42 | })
43 |
44 | txt <- c('some text', 'more text')
45 |
46 | it('multiple lines', {
47 | res <- c('a some text', 'more text z')
48 |
49 | set_text(paste0(txt, collapse = "\n"), sec = sec, mark = entire_document)
50 |
51 | enclose(before, after)
52 |
53 | rstudioapi::documentSave(sec$id)
54 |
55 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
56 |
57 | set_text(sec = sec)
58 | })
59 |
60 | it('multiple selections',{
61 | res <- paste0(before, txt, after)
62 |
63 | set_text(paste0(txt, collapse = "\n"), sec = sec, mark = individual_lines)
64 |
65 | enclose(before, after)
66 |
67 | rstudioapi::documentSave(sec$id)
68 |
69 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
70 |
71 | set_text(sec = sec)
72 | })
73 |
74 | })
75 |
--------------------------------------------------------------------------------
/tests/testthat/test-footnote.R:
--------------------------------------------------------------------------------
1 | testthat::context("footnotes")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('footnotes',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('empty',{
11 |
12 | footnoter()
13 |
14 | rstudioapi::documentSave(sec$id)
15 |
16 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'^[]')
17 |
18 | set_text(sec = sec)
19 | })
20 |
21 | it('highlighted',{
22 |
23 | set_text('some text',sec = sec, mark = entire_document)
24 |
25 | footnoter()
26 |
27 | rstudioapi::documentSave(sec$id)
28 |
29 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'^[some text]')
30 |
31 | set_text(sec = sec)
32 | })
33 |
34 | it('multiline',{
35 |
36 | set_text('some text\n more text',sec = sec, mark = entire_document)
37 |
38 | footnoter()
39 |
40 | rstudioapi::documentSave(sec$id)
41 |
42 | testthat::expect_equal(readLines(sec$path, warn = FALSE),c('^[some text',' more text]'))
43 |
44 | set_text(sec = sec)
45 | })
46 |
47 | it('multiselect',{
48 |
49 | set_text('some text\n more text',sec = sec, mark = individual_lines)
50 |
51 | footnoter()
52 |
53 | rstudioapi::documentSave(sec$id)
54 |
55 | testthat::expect_equal(readLines(sec$path, warn = FALSE),c('^[some text]','^[ more text]'))
56 |
57 | set_text(sec = sec)
58 | })
59 |
60 | })
61 |
--------------------------------------------------------------------------------
/tests/testthat/test-headr.R:
--------------------------------------------------------------------------------
1 | testthat::context("headr")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('add headers to source editor',{
6 | skip_if_not_rstudio()
7 | testthat::skip_on_travis()
8 |
9 | it(strrep('#',1),{
10 | remedy::h1r()
11 | rstudioapi::documentSave(sec$id)
12 | testthat::expect_equal(readLines(sec$path, warn = FALSE),this_strrep(1))
13 | set_text(sec = sec)
14 | })
15 |
16 | it(strrep('#',2),{
17 | remedy::h2r()
18 | rstudioapi::documentSave(sec$id)
19 | testthat::expect_equal(readLines(sec$path, warn = FALSE),this_strrep(2))
20 | set_text(sec = sec)
21 | })
22 |
23 | it(strrep('#',3),{
24 | remedy::h3r()
25 | rstudioapi::documentSave(sec$id)
26 | testthat::expect_equal(readLines(sec$path, warn = FALSE),this_strrep(3))
27 | set_text(sec = sec)
28 | })
29 |
30 | it(strrep('#',4),{
31 | remedy::h4r()
32 | rstudioapi::documentSave(sec$id)
33 | testthat::expect_equal(readLines(sec$path, warn = FALSE),this_strrep(4))
34 | set_text(sec = sec)
35 | })
36 |
37 | it(strrep('#',5),{
38 | remedy::h5r()
39 | rstudioapi::documentSave(sec$id)
40 | testthat::expect_equal(readLines(sec$path, warn = FALSE),this_strrep(5))
41 | set_text(sec = sec)
42 | })
43 |
44 | it(strrep('#',6),{
45 | remedy::h6r()
46 | rstudioapi::documentSave(sec$id)
47 | testthat::expect_equal(readLines(sec$path, warn = FALSE),this_strrep(6))
48 | set_text(sec = sec)
49 | })
50 |
51 | it('append',{
52 | set_text(txt = 'some text', sec = sec, mark = entire_document)
53 | remedy::h1r()
54 | rstudioapi::documentSave(sec$id)
55 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'# some text')
56 | set_text(sec = sec)
57 | })
58 |
59 | })
60 |
--------------------------------------------------------------------------------
/tests/testthat/test-image.R:
--------------------------------------------------------------------------------
1 | testthat::context("images")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('images',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('empty',{
11 |
12 | imager()
13 |
14 | rstudioapi::documentSave(sec$id)
15 |
16 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'![]()')
17 |
18 | set_text(sec = sec)
19 | })
20 |
21 | it('no description bad link',{
22 |
23 | set_text('text',sec = sec, mark = entire_document)
24 |
25 | imager()
26 |
27 | rstudioapi::documentSave(sec$id)
28 |
29 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'')
30 |
31 | set_text(sec = sec)
32 | })
33 |
34 | it('description bad link',{
35 |
36 | set_text('aaa text',sec = sec, mark = entire_document)
37 |
38 | imager()
39 |
40 | rstudioapi::documentSave(sec$id)
41 |
42 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'')
43 |
44 | set_text(sec = sec)
45 | })
46 |
47 | it('no description good link',{
48 |
49 | set_text('http://www.text.com',sec = sec, mark = entire_document)
50 |
51 | imager()
52 |
53 | rstudioapi::documentSave(sec$id)
54 |
55 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'')
56 |
57 | set_text(sec = sec)
58 | })
59 |
60 | it('single word description good link',{
61 |
62 | set_text('text http://www.text.com',sec = sec, mark = entire_document)
63 |
64 | imager()
65 |
66 | rstudioapi::documentSave(sec$id)
67 |
68 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'')
69 |
70 | set_text(sec = sec)
71 | })
72 |
73 | it('multiple word description good link',{
74 |
75 | set_text('more text http://www.text.com',sec = sec, mark = entire_document)
76 |
77 | imager()
78 |
79 | rstudioapi::documentSave(sec$id)
80 |
81 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'')
82 |
83 | set_text(sec = sec)
84 | })
85 |
86 | })
87 |
--------------------------------------------------------------------------------
/tests/testthat/test-latex.R:
--------------------------------------------------------------------------------
1 | testthat::context("latex")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('latex',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('empty',{
11 |
12 | latexr()
13 |
14 | rstudioapi::documentSave(sec$id)
15 |
16 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'$$')
17 |
18 | set_text(sec = sec)
19 | })
20 |
21 | it('highlighted',{
22 |
23 | set_text('some text',sec = sec, mark = entire_document)
24 |
25 | latexr()
26 |
27 | rstudioapi::documentSave(sec$id)
28 |
29 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'$some text$')
30 |
31 | set_text(sec = sec)
32 | })
33 |
34 | it('multiline',{
35 |
36 | set_text('some text\n more text',sec = sec, mark = entire_document)
37 |
38 | latexr()
39 |
40 | rstudioapi::documentSave(sec$id)
41 |
42 | testthat::expect_equal(readLines(sec$path, warn = FALSE),c('$some text',' more text$'))
43 |
44 | set_text(sec = sec)
45 | })
46 |
47 | it('multiselect',{
48 |
49 | set_text('some text\n more text',sec = sec, mark = individual_lines)
50 |
51 | latexr()
52 |
53 | rstudioapi::documentSave(sec$id)
54 |
55 | testthat::expect_equal(readLines(sec$path, warn = FALSE),c('$some text$','$ more text$'))
56 |
57 | set_text(sec = sec)
58 | })
59 |
60 | })
61 |
--------------------------------------------------------------------------------
/tests/testthat/test-link.R:
--------------------------------------------------------------------------------
1 | testthat::context("url and relative link detection")
2 |
3 | testthat::describe("urls are detected", {
4 | it('www',{
5 | testthat::expect_true(is_link("www.google.com"))
6 | })
7 | it('http',{
8 | testthat::expect_true(is_link("http://www.google.com"))
9 | })
10 | it('https',{
11 | testthat::expect_true(is_link("https://www.google.com"))
12 | })
13 | })
14 |
15 | testthat::describe("(potential) relative links are detected", {
16 | it('md',{
17 | testthat::expect_true(is_link("contributing.md"))
18 | })
19 | it('Rmd',{
20 | testthat::expect_true(is_link("report.Rmd"))
21 | })
22 | it('subdir file',{
23 | testthat::expect_true(is_link("figs/plot.png"))
24 | })
25 | it('subdir folder',{
26 | testthat::expect_true(is_link("docs/figs"))
27 | })
28 | })
29 |
30 | testthat::describe("image links are detected", {
31 | it('png',{
32 | testthat::expect_true(is_link("plot.png"))
33 | })
34 | it('jpg',{
35 | testthat::expect_true(is_link("plot.jpg"))
36 | })
37 | it('jpeg',{
38 | testthat::expect_true(is_link("plot.jpeg"))
39 | })
40 | it('gif',{
41 | testthat::expect_true(is_link("funny_cat.gif"))
42 | })
43 | })
44 |
45 | testthat::describe("invalid urls/links are not detected", {
46 | it('http/s',{
47 | testthat::expect_false(is_link("http"))
48 | testthat::expect_false(is_link("https"))
49 | })
50 | it('www',{
51 | testthat::expect_false(is_link("www"))
52 | testthat::expect_false(is_link("http://www."))
53 | })
54 | it('no .com',{
55 | testthat::expect_false(is_link("www.google."))
56 | })
57 | })
58 |
--------------------------------------------------------------------------------
/tests/testthat/test-list.R:
--------------------------------------------------------------------------------
1 | testthat::context("lists")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe("unordered lists", {
6 | skip_if_not_rstudio()
7 | testthat::skip_on_travis()
8 |
9 | it("empty", {
10 | listr()
11 |
12 | rstudioapi::documentSave(sec$id)
13 |
14 | testthat::expect_length(readLines(sec$path, warn = FALSE), 0)
15 |
16 | set_text(sec = sec)
17 | })
18 |
19 | it("highlighted", {
20 | set_text("some text", sec = sec, mark = entire_document)
21 |
22 | listr()
23 |
24 | rstudioapi::documentSave(sec$id)
25 |
26 | testthat::expect_equal(readLines(sec$path, warn = FALSE), "+ some text")
27 |
28 | set_text(sec = sec)
29 | })
30 |
31 | it("multiple lines", {
32 | set_text("some text\nmore text", sec = sec, mark = entire_document)
33 |
34 | listr()
35 |
36 | rstudioapi::documentSave(sec$id)
37 |
38 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c("+ some text", "+ more text"))
39 |
40 | set_text(sec = sec)
41 | })
42 |
43 | it("multiple lines with quote at start", {
44 | set_text('"some" text\nmore text', sec = sec, mark = entire_document)
45 |
46 | listr()
47 |
48 | rstudioapi::documentSave(sec$id)
49 |
50 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c('+ "some" text', "+ more text"))
51 |
52 | set_text(sec = sec)
53 | })
54 |
55 | it("multiple paragraphs", {
56 | set_text("some text\n\nmore text", sec = sec, mark = entire_document)
57 |
58 | listr()
59 |
60 | rstudioapi::documentSave(sec$id)
61 |
62 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c("+ some text", "", "+ more text"))
63 |
64 | set_text(sec = sec)
65 | })
66 |
67 | it("nested list", {
68 | set_text("some text\n more text", sec = sec, mark = entire_document)
69 |
70 | listr()
71 |
72 | rstudioapi::documentSave(sec$id)
73 |
74 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c("+ some text", " + more text"))
75 |
76 | set_text(sec = sec)
77 | })
78 | })
79 |
80 | testthat::describe("ordered lists", {
81 | skip_if_not_rstudio()
82 | testthat::skip_on_travis()
83 |
84 | it("empty", {
85 | olistr()
86 |
87 | rstudioapi::documentSave(sec$id)
88 |
89 | testthat::expect_length(readLines(sec$path, warn = FALSE), 0)
90 |
91 | set_text(sec = sec)
92 | })
93 |
94 | it("highlighted", {
95 | set_text("some text", sec = sec, mark = entire_document)
96 |
97 | olistr()
98 |
99 | rstudioapi::documentSave(sec$id)
100 |
101 | testthat::expect_equal(readLines(sec$path, warn = FALSE), "1. some text")
102 |
103 | set_text(sec = sec)
104 | })
105 |
106 | it("multiple lines", {
107 | set_text("some text\nmore text", sec = sec, mark = entire_document)
108 |
109 | olistr()
110 |
111 | rstudioapi::documentSave(sec$id)
112 |
113 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c("1. some text", "1. more text"))
114 |
115 | set_text(sec = sec)
116 | })
117 |
118 | it("multiple paragraphs", {
119 | set_text("some text\n\nmore text", sec = sec, mark = entire_document)
120 |
121 | olistr()
122 |
123 | rstudioapi::documentSave(sec$id)
124 |
125 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c("1. some text", "", "1. more text"))
126 |
127 | set_text(sec = sec)
128 | })
129 |
130 | it("nested list", {
131 | set_text("some text\n more text", sec = sec, mark = entire_document)
132 |
133 | olistr()
134 |
135 | rstudioapi::documentSave(sec$id)
136 |
137 | testthat::expect_equal(readLines(sec$path, warn = FALSE), c("1. some text", " 1. more text"))
138 |
139 | set_text(sec = sec)
140 | })
141 | })
142 |
--------------------------------------------------------------------------------
/tests/testthat/test-multiline_prefix.R:
--------------------------------------------------------------------------------
1 | testthat::context("multiline prefix")
2 |
3 | sec <- scratch_file()
4 |
5 |
6 | testthat::describe('prefix', {
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | add_multiline_prefix <- remedy:::add_multiline_prefix
11 |
12 | prefix <- 'prefix '
13 |
14 | it('empty',{
15 | res <- prefix
16 |
17 | add_multiline_prefix(prefix, as_is = FALSE)
18 |
19 | rstudioapi::documentSave(sec$id)
20 |
21 | testthat::expect_length(readLines(sec$path, warn = FALSE), 0)
22 |
23 | set_text(sec = sec)
24 | })
25 |
26 | it('empty as_is',{
27 | res <- prefix
28 |
29 | add_multiline_prefix(prefix, as_is = TRUE)
30 |
31 | rstudioapi::documentSave(sec$id)
32 |
33 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
34 |
35 | set_text(sec = sec)
36 | })
37 |
38 | txt <- 'some text'
39 |
40 | it('highlighted',{
41 | res <- paste0(prefix, txt)
42 |
43 | set_text(txt, sec = sec, mark = entire_document)
44 |
45 | add_multiline_prefix(prefix)
46 |
47 | rstudioapi::documentSave(sec$id)
48 |
49 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
50 |
51 | set_text(sec = sec)
52 | })
53 |
54 | txt <- c('some text', 'more text')
55 |
56 | it('multiple lines', {
57 | res <- paste0(prefix, txt)
58 |
59 | set_text(paste0(txt, collapse = "\n"), sec = sec, mark = entire_document)
60 |
61 | add_multiline_prefix(prefix)
62 |
63 | rstudioapi::documentSave(sec$id)
64 |
65 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
66 |
67 | set_text(sec = sec)
68 | })
69 |
70 | txt <- c('some text', '', 'more text')
71 |
72 | it("multiple paragraphs", {
73 | res <- paste0(c(prefix, '', prefix), txt)
74 |
75 | set_text(paste0(txt, collapse = "\n"), sec = sec, mark = entire_document)
76 |
77 | add_multiline_prefix(prefix, as_is = FALSE)
78 |
79 | rstudioapi::documentSave(sec$id)
80 |
81 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
82 |
83 | set_text(sec = sec)
84 | })
85 |
86 | it("multiple paragraphs as_is", {
87 | res <- paste0(prefix, txt)
88 |
89 | set_text(paste0(txt, collapse = "\n"), sec = sec, mark = entire_document)
90 |
91 | add_multiline_prefix(prefix, as_is = TRUE)
92 |
93 | rstudioapi::documentSave(sec$id)
94 |
95 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
96 |
97 | set_text(sec = sec)
98 | })
99 |
100 | txt <- c('some text', ' more text')
101 |
102 | it("nested list", {
103 | res <- c('prefix some text', ' prefix more text')
104 |
105 | set_text(paste0(txt, collapse = "\n"), sec = sec, mark = entire_document)
106 |
107 | add_multiline_prefix(prefix, as_is = FALSE)
108 |
109 | rstudioapi::documentSave(sec$id)
110 |
111 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
112 |
113 | set_text(sec = sec)
114 | })
115 | })
116 |
117 |
--------------------------------------------------------------------------------
/tests/testthat/test-prefix.R:
--------------------------------------------------------------------------------
1 | testthat::context("prefix")
2 |
3 | sec <- scratch_file()
4 |
5 |
6 | testthat::describe('prefix', {
7 | skip_if_not_rstudio()
8 |
9 | add_prefix <- remedy:::add_prefix
10 |
11 | prefix <- 'prefix '
12 |
13 | it('empty',{
14 | res <- prefix
15 |
16 | add_prefix(prefix)
17 |
18 | rstudioapi::documentSave(sec$id)
19 |
20 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
21 |
22 | set_text(sec = sec)
23 | })
24 |
25 | txt <- 'some text'
26 |
27 | it('line',{
28 | res <- paste0(prefix, txt)
29 |
30 | set_text(txt, sec = sec)
31 |
32 | add_prefix(prefix)
33 |
34 | rstudioapi::documentSave(sec$id)
35 |
36 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
37 |
38 | set_text(sec = sec)
39 | })
40 |
41 | it('highlighted',{
42 | res <- paste0(prefix, txt)
43 |
44 | set_text(txt, sec = sec, mark = entire_document)
45 |
46 | add_prefix(prefix)
47 |
48 | rstudioapi::documentSave(sec$id)
49 |
50 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
51 |
52 | set_text(sec = sec)
53 | })
54 |
55 | txt <- c('some text', 'more text')
56 |
57 | it('multiple lines', {
58 | res <- paste0(c(prefix, ''), txt)
59 |
60 | set_text(paste0(txt, collapse = "\n"), sec = sec, mark = entire_document)
61 |
62 | add_prefix(prefix)
63 |
64 | rstudioapi::documentSave(sec$id)
65 |
66 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
67 |
68 | set_text(sec = sec)
69 | })
70 |
71 | it('multiple selections',{
72 | res <- paste0(prefix, txt)
73 |
74 | set_text(paste0(txt, collapse = "\n"), sec = sec, mark = individual_lines)
75 |
76 | add_prefix(prefix)
77 |
78 | rstudioapi::documentSave(sec$id)
79 |
80 | testthat::expect_equal(readLines(sec$path, warn = FALSE), res)
81 |
82 | set_text(sec = sec)
83 | })
84 |
85 | })
86 |
--------------------------------------------------------------------------------
/tests/testthat/test-right.R:
--------------------------------------------------------------------------------
1 | testthat::context("copy text to the right")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('rightr',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('one word',{
11 |
12 | set_text('some \n ',sec = sec, mark = entire_document)
13 |
14 | rstudioapi::documentSave(sec$id)
15 |
16 | testthat::expect_message(rightr(),'This addin assumes one line is selected, 2 were selected')
17 |
18 | set_text(sec = sec)
19 | })
20 |
21 | it('one word',{
22 |
23 | set_text('some ',sec = sec)
24 |
25 | rightr()
26 |
27 | rstudioapi::documentSave(sec$id)
28 |
29 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'some some ')
30 |
31 | set_text(sec = sec)
32 | })
33 |
34 | it('multiple words',{
35 |
36 | set_text('some some ',sec = sec, mark = individual_lines)
37 |
38 | rightr()
39 |
40 | rstudioapi::documentSave(sec$id)
41 |
42 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'some some some some ')
43 |
44 | set_text(sec = sec)
45 | })
46 |
47 | it('highlighting',{
48 |
49 | set_text('some some ',sec = sec)
50 |
51 | rng <- rstudioapi::document_range(start = rstudioapi::document_position(1,6),
52 | end = rstudioapi::document_position(1,Inf))
53 |
54 | rstudioapi::setSelectionRanges(rng)
55 |
56 | rightr()
57 |
58 | rstudioapi::documentSave(sec$id)
59 |
60 | testthat::expect_equal(readLines(sec$path, warn = FALSE),'some some some ')
61 |
62 | set_text(sec = sec)
63 | })
64 |
65 | })
66 |
--------------------------------------------------------------------------------
/tests/testthat/test-url.R:
--------------------------------------------------------------------------------
1 | testthat::context("urls")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('urls',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('empty',{
11 |
12 | urlr()
13 |
14 | rstudioapi::documentSave(sec$id)
15 |
16 | testthat::expect_equal(readLines(sec$path,warn = FALSE),'[]()')
17 |
18 | set_text(sec = sec)
19 | })
20 |
21 | it('no description bad link',{
22 |
23 | set_text('text',sec = sec, mark = entire_document)
24 |
25 | urlr()
26 |
27 | rstudioapi::documentSave(sec$id)
28 |
29 | testthat::expect_equal(readLines(sec$path,warn = FALSE),'[](# Error : selection is not a URL)')
30 |
31 | set_text(sec = sec)
32 | })
33 |
34 | it('description bad link',{
35 |
36 | set_text('aaa text',sec = sec, mark = entire_document)
37 |
38 | urlr()
39 |
40 | rstudioapi::documentSave(sec$id)
41 |
42 | testthat::expect_equal(readLines(sec$path,warn = FALSE),'[aaa](# Error : selection is not a URL)')
43 |
44 | set_text(sec = sec)
45 | })
46 |
47 | it('no description good link',{
48 |
49 | set_text('http://www.text.com',sec = sec, mark = entire_document)
50 |
51 | urlr()
52 |
53 | rstudioapi::documentSave(sec$id)
54 |
55 | testthat::expect_equal(readLines(sec$path,warn = FALSE),'[http://www.text.com](http://www.text.com)')
56 |
57 | set_text(sec = sec)
58 | })
59 |
60 | it('single word description good link',{
61 |
62 | set_text('text http://www.text.com',sec = sec, mark = entire_document)
63 |
64 | urlr()
65 |
66 | rstudioapi::documentSave(sec$id)
67 |
68 | testthat::expect_equal(readLines(sec$path,warn = FALSE),'[text](http://www.text.com)')
69 |
70 | set_text(sec = sec)
71 | })
72 |
73 | it('multiple word description good link',{
74 |
75 | set_text('more text http://www.text.com',sec = sec, mark = entire_document)
76 |
77 | urlr()
78 |
79 | rstudioapi::documentSave(sec$id)
80 |
81 | testthat::expect_equal(readLines(sec$path,warn = FALSE),'[more text](http://www.text.com)')
82 |
83 | set_text(sec = sec)
84 | })
85 |
86 | })
87 |
--------------------------------------------------------------------------------
/tests/testthat/test-xaringan.R:
--------------------------------------------------------------------------------
1 | testthat::context("xaringan")
2 |
3 | if(rstudioapi::isAvailable()){
4 |
5 | path <- tempfile(pattern = 'test',fileext = '.R')
6 | file.create(path)
7 | rstudioapi::navigateToFile(path)
8 | Sys.sleep(1)
9 | sec <- rstudioapi::getSourceEditorContext()
10 |
11 | }
12 |
13 | testthat::describe('urls',{
14 |
15 | skip_if_not_rstudio()
16 | testthat::skip_on_travis()
17 |
18 | it('empty',{
19 |
20 | xaringanr()
21 |
22 | rstudioapi::documentSave(sec$id)
23 |
24 | testthat::expect_equal(readLines(path,warn = FALSE),
25 | c('.pull-left[','',']','','.pull-right[','',']')
26 | )
27 | set_text(sec = sec)
28 | })
29 |
30 | it('highlighted',{
31 |
32 | set_text('text',sec = sec, mark = individual_lines)
33 |
34 | xaringanr()
35 |
36 | rstudioapi::documentSave(sec$id)
37 |
38 | testthat::expect_equal(readLines(path,warn = FALSE),
39 | c('.pull-left[','',']','text','.pull-right[','',']'))
40 |
41 | set_text(sec = sec)
42 | })
43 |
44 | })
45 |
--------------------------------------------------------------------------------
/tests/testthat/test-youtube.R:
--------------------------------------------------------------------------------
1 | testthat::context("youtube")
2 |
3 | sec <- scratch_file()
4 |
5 | testthat::describe('images',{
6 |
7 | skip_if_not_rstudio()
8 | testthat::skip_on_travis()
9 |
10 | it('empty html',{
11 |
12 | youtuber()
13 |
14 | rstudioapi::documentSave(sec$id)
15 |
16 | testthat::expect_equal(readLines(sec$path, warn = FALSE),
17 | ''
18 | )
19 |
20 | set_text(sec = sec)
21 | })
22 |
23 | it('html',{
24 |
25 | set_text('https://www.youtube.com/watch?v=O_kYuxP2pLA',sec = sec, mark = entire_document)
26 |
27 | youtuber()
28 |
29 | rstudioapi::documentSave(sec$id)
30 |
31 | testthat::expect_equal(readLines(sec$path, warn = FALSE),
32 | '')
33 |
34 | set_text(sec = sec)
35 | })
36 | it('html width/height',{
37 |
38 | remedy_opts$set(list(youtube_height = 100 , youtube_width = 100 ))
39 |
40 | set_text('https://www.youtube.com/watch?v=O_kYuxP2pLA',sec = sec, mark = entire_document)
41 |
42 | youtuber()
43 |
44 | rstudioapi::documentSave(sec$id)
45 |
46 | testthat::expect_equal(readLines(sec$path, warn = FALSE),
47 | '')
48 |
49 | set_text(sec = sec)
50 | })
51 |
52 |
53 | it('html width/height',{
54 |
55 | remedy_opts$set(list(youtube_output = 'md'))
56 |
57 | set_text('https://www.youtube.com/watch?v=O_kYuxP2pLA',sec = sec, mark = entire_document)
58 |
59 | youtuber()
60 |
61 | rstudioapi::documentSave(sec$id)
62 |
63 | testthat::expect_equal(readLines(sec$path, warn = FALSE),
64 | '[](https://www.youtube.com/watch?v=O_kYuxP2pLA)')
65 |
66 | set_text(sec = sec)
67 | })
68 | })
69 |
70 | remedy_opts$restore()
--------------------------------------------------------------------------------
/vignettes/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 | *.R
3 |
--------------------------------------------------------------------------------
/vignettes/tests_and_coverage.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Tests and Coverage"
3 | date: "`r format(Sys.time(), '%d %B, %Y %H:%M:%S')`"
4 | output: rmarkdown::html_vignette
5 | vignette: >
6 | %\VignetteIndexEntry{covrpage: Tests and Coverage}
7 | %\VignetteEngine{knitr::rmarkdown}
8 | %\VignetteEncoding{UTF-8}
9 | ---
10 |
11 | ```{r setup, include = FALSE}
12 | knitr::opts_chunk$set(
13 | collapse = TRUE,
14 | comment = "#>",
15 | eval = FALSE
16 | )
17 | ```
18 |
19 |
20 | This output is created by
21 | [covrpage](https://github.com/yonicd/covrpage).
22 |
23 | ## Coverage
24 |
25 | Coverage summary is created using the
26 | [covr](https://github.com/r-lib/covr) package.
27 |
28 | | Object | Coverage (%) |
29 | | :----------------------------------------- | :----------: |
30 | | remedy | 0.62 |
31 | | [R/align.R](https://github.com/ThinkR-open/remedy/tree/master/R/align.R) | 0.00 |
32 | | [R/backtickr.R](https://github.com/ThinkR-open/remedy/tree/master/R/backtickr.R) | 0.00 |
33 | | [R/blockquoter.R](https://github.com/ThinkR-open/remedy/tree/master/R/blockquoter.R) | 0.00 |
34 | | [R/chunkr.R](https://github.com/ThinkR-open/remedy/tree/master/R/chunkr.R) | 0.00 |
35 | | [R/chunksplitr.R](https://github.com/ThinkR-open/remedy/tree/master/R/chunksplitr.R) | 0.00 |
36 | | [R/emphasize.R](https://github.com/ThinkR-open/remedy/tree/master/R/emphasize.R) | 0.00 |
37 | | [R/footnoter.R](https://github.com/ThinkR-open/remedy/tree/master/R/footnoter.R) | 0.00 |
38 | | [R/headr.R](https://github.com/ThinkR-open/remedy/tree/master/R/headr.R) | 0.00 |
39 | | [R/htmlcommentr.R](https://github.com/ThinkR-open/remedy/tree/master/R/htmlcommentr.R) | 0.00 |
40 | | [R/imager.R](https://github.com/ThinkR-open/remedy/tree/master/R/imager.R) | 0.00 |
41 | | [R/internal.R](https://github.com/ThinkR-open/remedy/tree/master/R/internal.R) | 0.00 |
42 | | [R/latexr.R](https://github.com/ThinkR-open/remedy/tree/master/R/latexr.R) | 0.00 |
43 | | [R/listr.R](https://github.com/ThinkR-open/remedy/tree/master/R/listr.R) | 0.00 |
44 | | [R/mover.R](https://github.com/ThinkR-open/remedy/tree/master/R/mover.R) | 0.00 |
45 | | [R/opts\_complete.R](https://github.com/ThinkR-open/remedy/tree/master/R/opts_complete.R) | 0.00 |
46 | | [R/opts.R](https://github.com/ThinkR-open/remedy/tree/master/R/opts.R) | 0.00 |
47 | | [R/tabler.R](https://github.com/ThinkR-open/remedy/tree/master/R/tabler.R) | 0.00 |
48 | | [R/urlr.R](https://github.com/ThinkR-open/remedy/tree/master/R/urlr.R) | 0.00 |
49 | | [R/xaringan.R](https://github.com/ThinkR-open/remedy/tree/master/R/xaringan.R) | 0.00 |
50 | | [R/youtuber.R](https://github.com/ThinkR-open/remedy/tree/master/R/youtuber.R) | 0.00 |
51 | | [R/utils.R](https://github.com/ThinkR-open/remedy/tree/master/R/utils.R) | 25.00 |
52 |
53 |
54 |
55 | ## Unit Tests
56 |
57 | Unit Test summary is created using the
58 | [testthat](https://github.com/r-lib/testthat)
59 | package.
60 |
61 | | file | n | time | error | failed | skipped | warning |
62 | | :----------------------------------------------------------- | -: | ----: | ----: | -----: | ------: | ------: |
63 | | [test-backtick.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-backtick.R) | 4 | 1.258 | 0 | 0 | 0 | 0 |
64 | | [test-blockquote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-blockquote.R) | 4 | 1.164 | 0 | 0 | 0 | 0 |
65 | | [test-chunk.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-chunk.R) | 4 | 1.261 | 0 | 0 | 0 | 0 |
66 | | [test-emphasizers.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-emphasizers.R) | 6 | 1.444 | 0 | 0 | 0 | 0 |
67 | | [test-enclose.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-enclose.R) | 4 | 1.116 | 0 | 0 | 0 | 0 |
68 | | [test-footnote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-footnote.R) | 4 | 1.145 | 0 | 0 | 0 | 0 |
69 | | [test-headr.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-headr.R) | 7 | 1.412 | 0 | 0 | 0 | 0 |
70 | | [test-image.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-image.R) | 6 | 1.761 | 0 | 0 | 0 | 0 |
71 | | [test-latex.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-latex.R) | 4 | 1.161 | 0 | 0 | 0 | 0 |
72 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R) | 16 | 0.019 | 0 | 0 | 0 | 0 |
73 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R) | 10 | 2.827 | 0 | 0 | 0 | 0 |
74 | | [test-multiline\_prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-multiline_prefix.R) | 7 | 1.956 | 0 | 0 | 0 | 0 |
75 | | [test-prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-prefix.R) | 5 | 1.451 | 0 | 0 | 0 | 0 |
76 | | [test-right.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-right.R) | 4 | 1.300 | 0 | 0 | 0 | 0 |
77 | | [test-url.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-url.R) | 6 | 1.790 | 0 | 0 | 0 | 0 |
78 | | [test-xaringan.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-xaringan.R) | 2 | 0.535 | 0 | 0 | 0 | 0 |
79 | | [test-youtube.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-youtube.R) | 4 | 1.114 | 0 | 0 | 0 | 0 |
80 |
81 |
82 |
83 | Show Detailed Test Results
84 |
85 |
86 | | file | context | test | status | n | time |
87 | | :---------------------------------------------------------------- | :------------------------------ | :--------------------------------------------------------- | :----- | -: | ----: |
88 | | [test-backtick.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-backtick.R#L17) | backticks | backticks: empty | PASS | 1 | 0.315 |
89 | | [test-backtick.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-backtick.R#L30) | backticks | backticks: highlighted | PASS | 1 | 0.315 |
90 | | [test-backtick.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-backtick.R#L43) | backticks | backticks: multiline | PASS | 1 | 0.307 |
91 | | [test-backtick.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-backtick.R#L56) | backticks | backticks: multiselect | PASS | 1 | 0.321 |
92 | | [test-blockquote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-blockquote.R#L14) | blockquoter | blockquoter: empty | PASS | 1 | 0.180 |
93 | | [test-blockquote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-blockquote.R#L26) | blockquoter | blockquoter: highlighted | PASS | 1 | 0.339 |
94 | | [test-blockquote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-blockquote.R#L38) | blockquoter | blockquoter: multiline | PASS | 1 | 0.312 |
95 | | [test-blockquote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-blockquote.R#L50) | blockquoter | blockquoter: multiparagraph | PASS | 1 | 0.333 |
96 | | [test-chunk.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-chunk.R#L28_L30) | chunks | splitting: splitting one chunk into two | PASS | 1 | 0.342 |
97 | | [test-chunk.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-chunk.R#L51_L53) | chunks | params: splitting one chunk into two carrying chunk params | PASS | 1 | 0.307 |
98 | | [test-chunk.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-chunk.R#L74_L76) | chunks | creating: full document | PASS | 1 | 0.282 |
99 | | [test-chunk.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-chunk.R#L96_L98) | chunks | wrapping: section | PASS | 1 | 0.330 |
100 | | [test-emphasizers.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-emphasizers.R#L16) | emphasizers | italics: empty | PASS | 1 | 0.176 |
101 | | [test-emphasizers.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-emphasizers.R#L29) | emphasizers | italics: highlighted | PASS | 1 | 0.314 |
102 | | [test-emphasizers.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-emphasizers.R#L47) | emphasizers | bold: empty | PASS | 1 | 0.175 |
103 | | [test-emphasizers.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-emphasizers.R#L60) | emphasizers | bold: highlighted | PASS | 1 | 0.301 |
104 | | [test-emphasizers.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-emphasizers.R#L78) | emphasizers | strike: empty | PASS | 1 | 0.171 |
105 | | [test-emphasizers.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-emphasizers.R#L91) | emphasizers | strike: highlighted | PASS | 1 | 0.307 |
106 | | [test-enclose.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-enclose.R#L22) | enclose | enclose: empty | PASS | 1 | 0.163 |
107 | | [test-enclose.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-enclose.R#L39) | enclose | enclose: highlighted | PASS | 1 | 0.309 |
108 | | [test-enclose.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-enclose.R#L55) | enclose | enclose: multiple lines | PASS | 1 | 0.320 |
109 | | [test-enclose.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-enclose.R#L69) | enclose | enclose: multiple selections | PASS | 1 | 0.324 |
110 | | [test-footnote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-footnote.R#L16) | footnotes | footnotes: empty | PASS | 1 | 0.199 |
111 | | [test-footnote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-footnote.R#L29) | footnotes | footnotes: highlighted | PASS | 1 | 0.303 |
112 | | [test-footnote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-footnote.R#L42) | footnotes | footnotes: multiline | PASS | 1 | 0.318 |
113 | | [test-footnote.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-footnote.R#L55) | footnotes | footnotes: multiselect | PASS | 1 | 0.325 |
114 | | [test-headr.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-headr.R#L12) | headr | add headers to source editor: \# | PASS | 1 | 0.176 |
115 | | [test-headr.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-headr.R#L19) | headr | add headers to source editor: \#\# | PASS | 1 | 0.180 |
116 | | [test-headr.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-headr.R#L26) | headr | add headers to source editor: \#\#\# | PASS | 1 | 0.169 |
117 | | [test-headr.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-headr.R#L33) | headr | add headers to source editor: \#\#\#\# | PASS | 1 | 0.177 |
118 | | [test-headr.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-headr.R#L40) | headr | add headers to source editor: \#\#\#\#\# | PASS | 1 | 0.167 |
119 | | [test-headr.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-headr.R#L47) | headr | add headers to source editor: \#\#\#\#\#\# | PASS | 1 | 0.171 |
120 | | [test-headr.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-headr.R#L55) | headr | add headers to source editor: append | PASS | 1 | 0.372 |
121 | | [test-image.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-image.R#L16) | images | images: empty | PASS | 1 | 0.174 |
122 | | [test-image.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-image.R#L29) | images | images: no description bad link | PASS | 1 | 0.309 |
123 | | [test-image.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-image.R#L42) | images | images: description bad link | PASS | 1 | 0.304 |
124 | | [test-image.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-image.R#L55) | images | images: no description good link | PASS | 1 | 0.350 |
125 | | [test-image.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-image.R#L68) | images | images: single word description good link | PASS | 1 | 0.305 |
126 | | [test-image.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-image.R#L81) | images | images: multiple word description good link | PASS | 1 | 0.319 |
127 | | [test-latex.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-latex.R#L16) | latex | latex: empty | PASS | 1 | 0.203 |
128 | | [test-latex.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-latex.R#L29) | latex | latex: highlighted | PASS | 1 | 0.307 |
129 | | [test-latex.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-latex.R#L42) | latex | latex: multiline | PASS | 1 | 0.313 |
130 | | [test-latex.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-latex.R#L55) | latex | latex: multiselect | PASS | 1 | 0.338 |
131 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L5) | url and relative link detection | urls are detected: www | PASS | 1 | 0.002 |
132 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L8) | url and relative link detection | urls are detected: http | PASS | 1 | 0.001 |
133 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L11) | url and relative link detection | urls are detected: https | PASS | 1 | 0.001 |
134 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L17) | url and relative link detection | (potential) relative links are detected: md | PASS | 1 | 0.001 |
135 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L20) | url and relative link detection | (potential) relative links are detected: Rmd | PASS | 1 | 0.001 |
136 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L23) | url and relative link detection | (potential) relative links are detected: subdir file | PASS | 1 | 0.001 |
137 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L26) | url and relative link detection | (potential) relative links are detected: subdir folder | PASS | 1 | 0.001 |
138 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L32) | url and relative link detection | image links are detected: png | PASS | 1 | 0.001 |
139 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L35) | url and relative link detection | image links are detected: jpg | PASS | 1 | 0.001 |
140 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L38) | url and relative link detection | image links are detected: jpeg | PASS | 1 | 0.001 |
141 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L41) | url and relative link detection | image links are detected: gif | PASS | 1 | 0.001 |
142 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L47) | url and relative link detection | invalid urls/links are not detected: http/s | PASS | 2 | 0.003 |
143 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L51) | url and relative link detection | invalid urls/links are not detected: www | PASS | 2 | 0.003 |
144 | | [test-link.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-link.R#L55) | url and relative link detection | invalid urls/links are not detected: no .com | PASS | 1 | 0.001 |
145 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L14) | lists | unordered lists: empty | PASS | 1 | 0.132 |
146 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L26) | lists | unordered lists: highlighted | PASS | 1 | 0.315 |
147 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L38) | lists | unordered lists: multiple lines | PASS | 1 | 0.323 |
148 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L50) | lists | unordered lists: multiple paragraphs | PASS | 1 | 0.328 |
149 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L62) | lists | unordered lists: nested list | PASS | 1 | 0.318 |
150 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L77) | lists | ordered lists: empty | PASS | 1 | 0.131 |
151 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L89) | lists | ordered lists: highlighted | PASS | 1 | 0.342 |
152 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L101) | lists | ordered lists: multiple lines | PASS | 1 | 0.312 |
153 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L113) | lists | ordered lists: multiple paragraphs | PASS | 1 | 0.314 |
154 | | [test-list.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-list.R#L125) | lists | ordered lists: nested list | PASS | 1 | 0.312 |
155 | | [test-multiline\_prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-multiline_prefix.R#L21) | multiline prefix | prefix: empty | PASS | 1 | 0.162 |
156 | | [test-multiline\_prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-multiline_prefix.R#L33) | multiline prefix | prefix: empty as\_is | PASS | 1 | 0.182 |
157 | | [test-multiline\_prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-multiline_prefix.R#L49) | multiline prefix | prefix: highlighted | PASS | 1 | 0.318 |
158 | | [test-multiline\_prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-multiline_prefix.R#L65) | multiline prefix | prefix: multiple lines | PASS | 1 | 0.333 |
159 | | [test-multiline\_prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-multiline_prefix.R#L81) | multiline prefix | prefix: multiple paragraphs | PASS | 1 | 0.319 |
160 | | [test-multiline\_prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-multiline_prefix.R#L95) | multiline prefix | prefix: multiple paragraphs as\_is | PASS | 1 | 0.322 |
161 | | [test-multiline\_prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-multiline_prefix.R#L111) | multiline prefix | prefix: nested list | PASS | 1 | 0.320 |
162 | | [test-prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-prefix.R#L20) | prefix | prefix: empty | PASS | 1 | 0.176 |
163 | | [test-prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-prefix.R#L36) | prefix | prefix: line | PASS | 1 | 0.311 |
164 | | [test-prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-prefix.R#L50) | prefix | prefix: highlighted | PASS | 1 | 0.302 |
165 | | [test-prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-prefix.R#L66) | prefix | prefix: multiple lines | PASS | 1 | 0.333 |
166 | | [test-prefix.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-prefix.R#L80) | prefix | prefix: multiple selections | PASS | 1 | 0.329 |
167 | | [test-right.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-right.R#L16) | copy text to the right | rightr: one word | PASS | 1 | 0.294 |
168 | | [test-right.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-right.R#L29) | copy text to the right | rightr: one word | PASS | 1 | 0.305 |
169 | | [test-right.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-right.R#L42) | copy text to the right | rightr: multiple words | PASS | 1 | 0.384 |
170 | | [test-right.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-right.R#L60) | copy text to the right | rightr: highlighting | PASS | 1 | 0.317 |
171 | | [test-url.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-url.R#L16) | urls | urls: empty | PASS | 1 | 0.181 |
172 | | [test-url.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-url.R#L29) | urls | urls: no description bad link | PASS | 1 | 0.339 |
173 | | [test-url.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-url.R#L42) | urls | urls: description bad link | PASS | 1 | 0.314 |
174 | | [test-url.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-url.R#L55) | urls | urls: no description good link | PASS | 1 | 0.311 |
175 | | [test-url.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-url.R#L68) | urls | urls: single word description good link | PASS | 1 | 0.321 |
176 | | [test-url.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-url.R#L81) | urls | urls: multiple word description good link | PASS | 1 | 0.324 |
177 | | [test-xaringan.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-xaringan.R#L24_L26) | xaringan | urls: empty | PASS | 1 | 0.182 |
178 | | [test-xaringan.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-xaringan.R#L38_L39) | xaringan | urls: highlighted | PASS | 1 | 0.353 |
179 | | [test-youtube.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-youtube.R#L16_L18) | youtube | images: empty html | PASS | 1 | 0.180 |
180 | | [test-youtube.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-youtube.R#L31_L32) | youtube | images: html | PASS | 1 | 0.319 |
181 | | [test-youtube.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-youtube.R#L46_L47) | youtube | images: html width/height | PASS | 1 | 0.312 |
182 | | [test-youtube.R](https://github.com/ThinkR-open/remedy/tree/master/tests/testthat/test-youtube.R#L63_L64) | youtube | images: html width/height | PASS | 1 | 0.303 |
183 |
184 |
185 |
186 |
187 |
188 | Session Info
189 |
190 | | Field | Value |
191 | | :------- | :---------------------------------- |
192 | | Version | R version 3.5.1 (2018-07-02) |
193 | | Platform | x86\_64-apple-darwin15.6.0 (64-bit) |
194 | | Running | macOS High Sierra 10.13.6 |
195 | | Language | en\_US |
196 | | Timezone | America/New\_York |
197 |
198 | | Package | Version |
199 | | :------- | :--------- |
200 | | testthat | 2.0.0.9000 |
201 | | covr | 3.2.0 |
202 | | covrpage | 0.0.61 |
203 |
204 |
205 |
206 |
207 |
--------------------------------------------------------------------------------