Skip to content

Commit

Permalink
Add vanilla details block addin
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-dray committed Oct 22, 2019
1 parent 2702f9d commit 96f7316
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 10 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Expand Up @@ -12,3 +12,5 @@ License: CC0
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
Suggests:
rstudioapi
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -3,3 +3,4 @@
export(addin_details)
export(addin_img_accessible)
export(addin_new_tab)
export(addin_session_details)
17 changes: 16 additions & 1 deletion R/insert_blogdown_helpers.R
@@ -1,11 +1,26 @@
#' Insert expandable details block
#'
#' Call this function as an addin to insert at the cursor position an expandable
#' HTML details block.
#'
#' @export
addin_details <- function() {

rstudioapi::insertText('<details><summary>Click for details</summary>
Text goes here
</details>'
)

}

#' Insert expandable session details block
#'
#' Call this function as an addin to insert at the cursor position an expandable
#' HTML details block containing an R Markdown chunk containing the session info
#' and current system date.
#'
#' @export
addin_details <- function() {
addin_session_details <- function() {

rstudioapi::insertText('<details><summary>Session info</summary>
```{r sessioninfo, echo=FALSE}
Expand Down
6 changes: 2 additions & 4 deletions docs/reference/addin_details.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

147 changes: 147 additions & 0 deletions docs/reference/addin_session_details.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions inst/rstudio/addins.dcf
@@ -1,14 +1,19 @@
Name: Insert details block
Description: Inserts an HTML details block with R Markdown chunk at the cursor position.
Description: Inserts at the cursor position an HTML details block.
Binding: addin_details
Interactive: false

Name: Insert session details block
Description: Inserts at the cursor position an HTML details block with R Markdown chunk containing.
Binding: addin_session_details
Interactive: false

Name: Insert accessible image
Description: Inserts an HTML image code with caption and alt text at the cursor position.
Description: Inserts at the cursor position HTML image code with caption and alt text.
Binding: addin_img_accessible
Interactive: false

Name: Insert new tab link
Description: Inserts a Markdown web link that will open in a new tab when clicked.
Description: Inserts at the cursor position a Markdown web link that will open in a new tab when clicked.
Binding: addin_new_tab
Interactive: false
3 changes: 1 addition & 2 deletions man/addin_details.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions man/addin_session_details.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 96f7316

Please sign in to comment.