README.md

CRAN
status downloads R-win build
status R-mac build
status R-linux build
status Codecov test
coverage Covrpage
Summary

details

Suppose you’re opening an issue in GitHub and there’s a lot noisey logs that may be useful or you want to add the sessionInfo() to the end of the issue.

Rather than wrecking readability, wrapping it in a <details> tag is a great solution

<details>
 <summary>Summary Goes Here</summary>
 ...this is hidden, collapsable content...
</details>

Doing this manually every time is a pain.

details is a package lets you create and customize details blocks for markdown documents and Roxygen2 documentation within R.

Installation

CRAN

install.packages("details")

Dev

remotes::install_github("yonicd/details")

Markdown

Input

The function details::details can handle inputs

Output

The function details::details can output the result to

Examples

One the most popular uses for details is to paste the sessioninfo at the bottom of a GitHub issue.

library(details)

sessioninfo::session_info()%>%
  details::details(summary = 'current session info')

current session info


─ Session info ──────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       macOS Mojave 10.14.5        
 system   x86_64, darwin15.6.0        
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2020-01-12                  

─ Packages ──────────────────────────────────────────────────────────────
 package     * version    date       lib source                         
 assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                 
 backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.0)                 
 cli           2.0.0      2019-12-09 [1] CRAN (R 3.6.0)                 
 clipr         0.7.0      2019-07-23 [1] CRAN (R 3.6.0)                 
 crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                 
 desc          1.2.0      2019-12-01 [1] Github (r-lib/desc@61205f6)    
 details     * 0.2.1      2020-01-12 [1] local                          
 digest        0.6.23     2019-11-23 [1] CRAN (R 3.6.0)                 
 evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                 
 fansi         0.4.0      2018-10-05 [1] CRAN (R 3.6.0)                 
 glue          1.3.1.9000 2020-01-07 [1] Github (tidyverse/glue@b9ffe6c)
 htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.0)                 
 httr          1.4.1      2019-08-05 [1] CRAN (R 3.6.0)                 
 knitr         1.25       2019-09-18 [1] CRAN (R 3.6.0)                 
 magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.0)                 
 png           0.1-7      2013-12-03 [1] CRAN (R 3.6.0)                 
 R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.0)                 
 Rcpp          1.0.3      2019-11-08 [1] CRAN (R 3.6.1)                 
 rlang         0.4.2      2019-11-23 [1] CRAN (R 3.6.0)                 
 rmarkdown     2.0        2019-12-12 [1] CRAN (R 3.6.0)                 
 rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)                 
 sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                 
 stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                 
 stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                 
 withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                 
 xfun          0.10       2019-10-01 [1] CRAN (R 3.6.0)                 
 xml2          1.2.2      2019-08-09 [1] CRAN (R 3.6.0)                 
 yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                 

[1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

You can also use the knitr chunk engine that is shipped with details to created outputs in Rmarkdown documents.

```{details, echo = FALSE, details.summary = 'current session info'}
sessioninfo::session_info()
```

current session info


─ Session info ──────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       macOS Mojave 10.14.5        
 system   x86_64, darwin15.6.0        
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2020-01-12                  

─ Packages ──────────────────────────────────────────────────────────────
 package     * version    date       lib source                         
 assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                 
 backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.0)                 
 cli           2.0.0      2019-12-09 [1] CRAN (R 3.6.0)                 
 clipr         0.7.0      2019-07-23 [1] CRAN (R 3.6.0)                 
 crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                 
 desc          1.2.0      2019-12-01 [1] Github (r-lib/desc@61205f6)    
 details     * 0.2.1      2020-01-12 [1] local                          
 digest        0.6.23     2019-11-23 [1] CRAN (R 3.6.0)                 
 evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                 
 fansi         0.4.0      2018-10-05 [1] CRAN (R 3.6.0)                 
 glue          1.3.1.9000 2020-01-07 [1] Github (tidyverse/glue@b9ffe6c)
 htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.0)                 
 httr          1.4.1      2019-08-05 [1] CRAN (R 3.6.0)                 
 knitr         1.25       2019-09-18 [1] CRAN (R 3.6.0)                 
 magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.0)                 
 png           0.1-7      2013-12-03 [1] CRAN (R 3.6.0)                 
 R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.0)                 
 Rcpp          1.0.3      2019-11-08 [1] CRAN (R 3.6.1)                 
 rlang         0.4.2      2019-11-23 [1] CRAN (R 3.6.0)                 
 rmarkdown     2.0        2019-12-12 [1] CRAN (R 3.6.0)                 
 rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)                 
 sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                 
 stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                 
 stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                 
 withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                 
 xfun          0.10       2019-10-01 [1] CRAN (R 3.6.0)                 
 xml2          1.2.2      2019-08-09 [1] CRAN (R 3.6.0)                 
 yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                 

[1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

There are a number of objects that can be placed in a details block other than a character object. An example of a object is a device output such as a plot

details(plot(x=mtcars$mpg,y=mtcars$wt), summary = 'My plot')

My plot

Package Documentation

Many times in documentation there is a lot to say, but you do not want to overwhelm the user.

To solve this we can use folding blocks in the documentation (which are then rendered into pkgdown website automatically)

Setup

To make it easy to set up the DESCRIPTION file of your package so you can use details macros run the following :

use_details('PATH_TO_DESCRIPTION_FILE')

This will append three elements to the DESCRIPTION file

Usage

You can use this feature by wrapping documentation with the macros

\foldstart{[SUMMARY TEXT]}

#' DOCUMENTATION
#' ...
#' DOCUMENTATION

\foldend

The SUMMARY_TEXT is optional, where the folded block will have a header of SUMMARY TEXT.

The default will display details.

These folded blocks can be inserted anywhere in the documentation, eg @description, @param, @details, @return, ….

Vignettes

More information can be found in the articles of the package site.

Code of Conduct

Please note that the ‘details’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



Try the details package in your browser

Any scripts or data that you put into this service are public.

details documentation built on Jan. 12, 2020, 6:19 p.m.