-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathREADME.Rmd
More file actions
132 lines (97 loc) · 4.73 KB
/
Copy pathREADME.Rmd
File metadata and controls
132 lines (97 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
output: github_document
---
<!-- badges: start -->
[](https://www.tidyverse.org/lifecycle/#experimental)
[](https://github.com/ThinkR-open/papillon/actions)
[](https://app.codecov.io/gh/ThinkR-open/papillon?branch=main)
<!-- badges: end -->
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# papillon
<!-- description: start -->
This is package {papillon}: Build And Highlight Package Documentation With Customized
Templates.
You are using version 0.0.1.9000.
<!-- description: end -->
*Complete documentation in the {pkgdown} site: https://thinkr-open.github.io/papillon/*
## Installation
<!-- install: start -->
The list of dependencies required to install this package is: attachment, bookdown, cli, crayon, desc, devtools, knitr, magrittr, pkgdown, readr, remotes, rmarkdown, shiny, usethis, utils.
To install the package, you can run the following script
```{r, echo=TRUE, eval=FALSE}
# install.packages("remotes")
remotes::install_github(repo = "Thinkr-open/papillon")
```
<!-- install: end -->
## Examples
### Build a book from vignettes inside a package
You can use `create_book()` using your own template basis. By default, it uses {bookdown} site template. You can use it to build your own.
```{r, eval=FALSE}
template <- system.file("rstudio/templates/project/resources", package = "bookdown")
create_book(path = "inst/report", clean = TRUE,
template = template)
```
Help users find your book with function `open_guide_function()`. This adds function `open_guide()` inside your package that will open the userguide (in HTML or PDF) on demand.
```{r, eval=FALSE}
open_guide_function(path = "inst/report")
```
### Build a pkgdown site inside a package
You can use `build_pkgdown()` using your own template basis. By default, it uses the {pkgdown} original template.
To use your own template, it is better to create a R package with all necessary files (See <https://github.com/tidyverse/tidytemplate> as an example).
*You can then define your own `_pkgdown.yml` file that will call your template when building the site:*
```yaml
template:
package: mypackagetemplate
```
```{r, eval=FALSE}
papillon::build_pkgdown(
lazy = TRUE,
yml = "/pah/to/your/yaml/_pkgdown.yml",
favicon = "/path/to/your/favicon.ico",
move = TRUE
)
```
Help users find your pkgdown website with function `open_pkgdown_function()`. This adds function `open_pkgdown()` inside your package that will open the site on demand. _This may make your package not pass warnings in checks, but remember this is for internal or private use. For public use, you can publish your pkgdown site directly online._
```{r, eval=FALSE}
papillon::open_pkgdown_function()
```
### Build a reference page
To award people hard working for open-source, it is always good to cite their work. In order to add an informative page in your Shiny applications for instance, you can create a html or markdown page listing all package dependencies used.
```{r, eval=FALSE}
papillon::create_pkg_biblio_file(to = "html", out.dir = "inst")
# Can be included in a shiny app using
shiny::includeHTML("bibliography.html")
# OR
papillon::create_pkg_biblio_file(to = "markdown")
# Can be included in a shiny app using
shiny::includeMarkdown("bibliography.md")
```
## To describe your package and how to install it
This can be useful to create your Readme for instance or to send the instructions file for your clients to install your package.
```{r, eval=FALSE}
path <- system.file("DESCRIPTION", package = "papillon")
out.dir <- tempdir()
create_pkg_desc_file(path, source = c("archive"), to = "html")
```
```{r, eval=FALSE}
# Use with results="asis" in a Rmd
shiny::includeHTML(file.path(out.dir, "pkg_description.html"))
```
## Create and update a custom README with installation instructions
- `generate_readme()` uses {usethis} Readme template for packages and fill the installation instructions.
- This function can be run anytime during project development as it will only update the description and installation parts
```{r, eval=FALSE}
#usethis::use_readme_rmd
papillon::generate_readme_rmd()
papillon::generate_readme_rmd(parts = "description")
```
## Code of Conduct
Please note that the papillon project is released with a [Contributor Code of Conduct](https://thinkr-open.github.io/papillon/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.