Skip to content
Build And Highlight Package Documentation With Customized Templates
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Change default path in open_pkgdown_function Jul 19, 2019
inst Remove internal pkgdown Jul 3, 2019
man Change default path in open_pkgdown_function Jul 19, 2019
vignettes
.Rbuildignore Update Readme: link pkgdown and CoC Jul 19, 2019
.gitignore
.travis.yml add Travis Jul 3, 2019
CODE_OF_CONDUCT.md
DESCRIPTION
LICENSE.md Add pkgdown functions to include in a package Feb 15, 2019
NAMESPACE add Travis Jul 3, 2019
README.Rmd Update Readme: link pkgdown and CoC Jul 19, 2019
README.md Update Readme: link pkgdown and CoC Jul 19, 2019
_pkgdown.yml Add pkgdown functions to include in a package Feb 15, 2019
devstuff_history.R

README.md

lifecycle Travis build status

chameleon

The goal of {chameleon} is to build and highlight package documentation with customized templates.

Complete documentation in the {pkgdown} site: https://thinkr-open.github.io/chameleon/

Installation

# install.packages("remotes")
remotes::install_github("ThinkR-open/chameleon")

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.

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.

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:

template:
  package: mypackagetemplate
chameleon::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.

chameleon::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.

chameleon::create_pkg_biblio_file(to = "html", out.dir = "inst")
# Can be included in a shiny app using 
shiny::includeHTML("bibliography.html")
# OR
chameleon::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.

path <- system.file("DESCRIPTION", package = "chameleon")
out.dir <- tempdir()
create_pkg_desc_file(path, source = c("archive"), to = "html")
# Use with results="asis" in a Rmd
shiny::includeHTML(file.path(out.dir, "pkg_description.html"))

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

You can’t perform that action at this time.