12 Including extras for litr
12.1 README with hex sticker
We include a README.Rmd
and then generate the README.md
based on it:
add_readme(file.path("..", "source-files", "README.Rmd"))
## ✔ Writing 'README.Rmd'.
## ✔ Adding "^README\\.Rmd$" to '.Rbuildignore'.
## ✔ Creating '.git/hooks/'.
## ✔ Writing '.git/hooks/pre-commit'.
Let’s add the litr
hex sticker too (which is referred to in the README).
add_hex_sticker(file.path("..", "source-files", "litr-hex.png"))
Let’s also add a figure we include in the README.
12.2 Vignettes
add_vignettes(c(file.path("..", "source-files", "package-templates.Rmd"),
file.path("..", "source-files", "packages-in-the-wild.Rmd"),
file.path("..", "source-files", "faqs.Rmd"),
file.path("..", "source-files", "basic-example.Rmd"),
file.path("..", "source-files", "videos.Rmd")))
The templates vignette uses dplyr
and stringr
, so we add them as “Suggests” in the DESCRIPTION file:
## ✔ Adding dplyr to 'Suggests' field in DESCRIPTION.
## ☐ Use `requireNamespace("dplyr", quietly = TRUE)` to test if dplyr is
## installed.
## ☐ Then directly refer to functions with `dplyr::fun()`.
## ! Package stringr is already listed in 'Imports' in DESCRIPTION; no change
## made.
12.3 A pkgdown site
We’ll first add the github url to the DESCRIPTION file.
## Package: litr
## Title: Literate Programming for Writing R Packages
## Version: 0.9.3
## Authors@R (parsed):
## * Jacob Bien <jbien@usc.edu> [aut, cre]
## * Patrick Vossler [aut]
## Description: Allows one to fully create an R package in a single .Rmd
## file. Includes functionality and .Rmd templates for a literate
## programming approach to R package development.
## License: MIT + file LICENSE
## URL: https://github.com/jacobbien/litr-project/tree/main/litr
## Imports:
## bookdown,
## desc,
## devtools,
## digest,
## fansi,
## fs,
## knitr,
## pkgdown,
## rmarkdown,
## stringr,
## usethis,
## xfun,
## xml2,
## yaml
## Suggests:
## dplyr,
## Rcpp,
## testthat (>= 3.0.0)
## VignetteBuilder:
## knitr
## Config/testthat/edition: 3
## Encoding: UTF-8
## Roxygen: list(markdown = TRUE)
## RoxygenNote: 7.3.2
Next, we create the pkgdown site. The customizations come from the source file source-files/_pkgdown.yml
.
pkgdown_yml <- file.path("..", "source-files", "_pkgdown.yml")
add_pkgdown(pkgdown_yml)
## ✔ Adding "^_pkgdown\\.yml$", "^docs$", and "^pkgdown$" to '.Rbuildignore'.
## ── Installing package litr into temporary library ──────────────────────────────
## ── Building pkgdown site for package litr ──────────────────────────────────────
## Reading from: /Users/jacobbien/Documents/GitHub/litr-project/litr
## Writing to: /Users/jacobbien/Documents/GitHub/litr-project/docs
## ── Sitrep ──────────────────────────────────────────────────────────────────────
## ✖ URLs not ok.
## In _pkgdown.yml, url is missing.
## See details in `vignette(pkgdown::metadata)`.
## ✖ Favicons not ok.
## Found package logo but not favicons.
## Do you need to run `build_favicons()`?
## ✔ Open graph metadata ok.
## ✔ Articles metadata ok.
## ✔ Reference metadata ok.
## ── Initialising site ───────────────────────────────────────────────────────────
## Copying <pkgdown>/BS5/assets/katex-auto.js to katex-auto.js
## Copying <pkgdown>/BS5/assets/lightswitch.js to lightswitch.js
## Copying <pkgdown>/BS5/assets/pkgdown.js to pkgdown.js
## Updating deps/bootstrap-5.3.1/bootstrap.min.css
## Updating deps/bootstrap-5.3.1/font.css
## Updating deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyC0ITw.woff2
## Updating deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCAIT5lu.woff2
## Updating deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCIIT5lu.woff2
## Updating deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCMIT5lu.woff2
## Updating deps/bootstrap-5.3.1/fonts/1Ptug8zYS_SKggPNyCkIT5lu.woff2
## Updating deps/bootstrap-5.3.1/fonts/JTUSjIg1_i6t8kCHKm459W1hyzbi.woff2
## Updating deps/bootstrap-5.3.1/fonts/JTUSjIg1_i6t8kCHKm459WRhyzbi.woff2
## Updating deps/bootstrap-5.3.1/fonts/JTUSjIg1_i6t8kCHKm459WZhyzbi.woff2
## Updating deps/bootstrap-5.3.1/fonts/JTUSjIg1_i6t8kCHKm459Wdhyzbi.woff2
## Updating deps/bootstrap-5.3.1/fonts/JTUSjIg1_i6t8kCHKm459Wlhyw.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fABc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fBBc4.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fBxc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fCBc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmEU9fCxc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fBBc4.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfBBc4.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu4WxKOzY.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu4mxK.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu5mxKOzY.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu72xKOzY.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu7GxKOzY.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu7WxKOzY.woff2
## Updating deps/bootstrap-5.3.1/fonts/KFOmCnqEu92Fr1Mu7mxKOzY.woff2
## Updating
## deps/bootstrap-5.3.1/fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa0ZL7SUc.woff2
## Updating deps/bootstrap-5.3.1/fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7.woff2
## Updating
## deps/bootstrap-5.3.1/fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7SUc.woff2
## Updating
## deps/bootstrap-5.3.1/fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa25L7SUc.woff2
## Updating
## deps/bootstrap-5.3.1/fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7SUc.woff2
## Updating
## deps/bootstrap-5.3.1/fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7SUc.woff2
## Updating
## deps/bootstrap-5.3.1/fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2pL7SUc.woff2
## Updating deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js
## Updating deps/clipboard.js-2.0.11/clipboard.min.js
## Updating deps/font-awesome-6.5.2/css/all.css
## Updating deps/font-awesome-6.5.2/css/all.min.css
## Updating deps/font-awesome-6.5.2/css/v4-shims.css
## Updating deps/font-awesome-6.5.2/css/v4-shims.min.css
## Updating deps/font-awesome-6.5.2/webfonts/fa-brands-400.ttf
## Updating deps/font-awesome-6.5.2/webfonts/fa-brands-400.woff2
## Updating deps/font-awesome-6.5.2/webfonts/fa-regular-400.ttf
## Updating deps/font-awesome-6.5.2/webfonts/fa-regular-400.woff2
## Updating deps/font-awesome-6.5.2/webfonts/fa-solid-900.ttf
## Updating deps/font-awesome-6.5.2/webfonts/fa-solid-900.woff2
## Updating deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.ttf
## Updating deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.woff2
## Updating deps/headroom-0.11.0/headroom.min.js
## Updating deps/headroom-0.11.0/jQuery.headroom.min.js
## Updating deps/search-1.0.0/autocomplete.jquery.min.js
## Updating deps/search-1.0.0/fuse.min.js
## Updating deps/search-1.0.0/mark.min.js
## ── Building favicons ───────────────────────────────────────────────────────────
## ℹ Building favicons with <https://realfavicongenerator.net>...
## ✔ Added 'apple-touch-icon.png', 'favicon-96x96.png', 'favicon.ico',
## 'favicon.svg', 'site.webmanifest', 'web-app-manifest-192x192.png', and
## 'web-app-manifest-512x512.png'.
## Copying pkgdown/favicon/apple-touch-icon.png to apple-touch-icon.png
## Copying pkgdown/favicon/favicon-96x96.png to favicon-96x96.png
## Copying pkgdown/favicon/favicon.ico to favicon.ico
## Copying pkgdown/favicon/favicon.svg to favicon.svg
## Copying pkgdown/favicon/site.webmanifest to site.webmanifest
## Copying pkgdown/favicon/web-app-manifest-192x192.png to
## web-app-manifest-192x192.png
## Copying pkgdown/favicon/web-app-manifest-512x512.png to
## web-app-manifest-512x512.png
## ── Building home ───────────────────────────────────────────────────────────────
## ✖ Icon "fa-github" lacks an `aria-label`.
## ℹ Specify `aria-label` to make the icon accessible to screen readers.
## ℹ Learn more in `vignette(pkgdown::accessibility)`.
## This message is displayed once every 8 hours.
## Writing `authors.html`
## Reading LICENSE.md
## Writing `LICENSE.html`
## Writing `LICENSE-text.html`
## Reading README.md
## Writing `index.html`
## Writing `404.html`
## ── Building function reference ─────────────────────────────────────────────────
## Writing `reference/index.html`
## Reading man/add_chunk_label_hyperlinks.Rd
## Writing `reference/add_chunk_label_hyperlinks.html`
## Reading man/add_function_hyperlinks.Rd
## Writing `reference/add_function_hyperlinks.html`
## Reading man/add_hex_sticker.Rd
## Writing `reference/add_hex_sticker.html`
## Reading man/add_pkgdown.Rd
## Writing `reference/add_pkgdown.html`
## Reading man/add_readme.Rd
## Writing `reference/add_readme.html`
## Reading man/add_text_to_file.Rd
## Writing `reference/add_text_to_file.html`
## Reading man/add_vignettes.Rd
## Writing `reference/add_vignettes.html`
## Reading man/check_unedited.Rd
## Writing `reference/check_unedited.html`
## Reading man/create_from_template.Rd
## Writing `reference/create_from_template.html`
## Reading man/description_litr_hash_field_name.Rd
## Writing `reference/description_litr_hash_field_name.html`
## Reading man/description_litr_version_field_name.Rd
## Writing `reference/description_litr_version_field_name.html`
## Reading man/do_not_edit_message.Rd
## Writing `reference/do_not_edit_message.html`
## Reading man/document.Rd
## Writing `reference/document.html`
## Reading man/draft.Rd
## Writing `reference/draft.html`
## Reading man/draft_armadillo.Rd
## Writing `reference/draft_armadillo.html`
## Reading man/draft_bookdown.Rd
## Writing `reference/draft_bookdown.html`
## Reading man/draft_data.Rd
## Writing `reference/draft_data.html`
## Reading man/draft_extras.Rd
## Writing `reference/draft_extras.html`
## Reading man/draft_rcpp.Rd
## Writing `reference/draft_rcpp.html`
## Reading man/find_labels.Rd
## Writing `reference/find_labels.html`
## Reading man/get_package_directory.Rd
## Writing `reference/get_package_directory.html`
## Reading man/get_params_used.Rd
## Writing `reference/get_params_used.html`
## Reading man/hash_package_directory.Rd
## Writing `reference/hash_package_directory.html`
## Reading man/insert_hrefs.Rd
## Writing `reference/insert_hrefs.html`
## Reading man/litr-package.Rd
## Writing `reference/litr-package.html`
## Reading man/litr_gitbook.Rd
## Writing `reference/litr_gitbook.html`
## Reading man/litr_html_document.Rd
## Writing `reference/litr_html_document.html`
## Reading man/litr_pdf_document.Rd
## Writing `reference/litr_pdf_document.html`
## Reading man/litrify_output_format.Rd
## Writing `reference/litrify_output_format.html`
## Reading man/load_all.Rd
## Writing `reference/load_all.html`
## Reading man/make_noticeable.Rd
## Writing `reference/make_noticeable.html`
## Reading man/read_hash_from_description.Rd
## Writing `reference/read_hash_from_description.html`
## Reading man/remove_rstudio_extras.Rd
## Writing `reference/remove_rstudio_extras.html`
## Reading man/render.Rd
## Writing `reference/render.html`
## Reading man/replace_ansi_sequences.Rd
## Writing `reference/replace_ansi_sequences.html`
## Reading man/restore_knitr_objects.Rd
## Writing `reference/restore_knitr_objects.html`
## Reading man/send_to_package.Rd
## Writing `reference/send_to_package.html`
## Reading man/setup.Rd
## Writing `reference/setup.html`
## Reading man/test_litr.Rd
## Writing `reference/test_litr.html`
## Reading man/with_cleanup.Rd
## Writing `reference/with_cleanup.html`
## Reading man/write_hash_to_description.Rd
## Writing `reference/write_hash_to_description.html`
## Reading man/write_version_to_description.Rd
## Writing `reference/write_version_to_description.html`
## ── Building articles ───────────────────────────────────────────────────────────
## Writing `articles/index.html`
## Reading vignettes/basic-example.Rmd
## Writing `articles/basic-example.html`
## ✖ Missing alt-text in 'vignettes/basic-example.Rmd'
## • basic-example_files/figure-html/unnamed-chunk-5-1.png
## ℹ Learn more in `vignette(pkgdown::accessibility)`.
## Reading vignettes/faqs.Rmd
## Writing `articles/faqs.html`
## Reading vignettes/package-templates.Rmd
## Writing `articles/package-templates.html`
## Reading vignettes/packages-in-the-wild.Rmd
## Writing `articles/packages-in-the-wild.html`
## Reading vignettes/videos.Rmd
## Writing `articles/videos.html`
## ── Building sitemap ────────────────────────────────────────────────────────────
## Writing `sitemap.xml`
## ── Building search index ───────────────────────────────────────────────────────
## ── Checking for problems ───────────────────────────────────────────────────────
## ── Finished building pkgdown site for package litr ─────────────────────────────
## ── Finished building pkgdown site for package litr ─────────────────────────────
We follow this pkgdown
vignette in our customizations. Here is the contents of the _pkgdown.yml
that was used:
destination: ../docs/
url: ~
template:
bootstrap: 5
bootswatch: cosmo
repo:
url:
home: https://github.com/jacobbien/litr-project/tree/main/litr/
source: https://github.com/jacobbien/litr-project/tree/main/litr/
issue: https://github.com/jacobbien/litr-project/issues/
user: https://github.com/
authors:
Jacob Bien:
href: http://faculty.marshall.usc.edu/jacob-bien/
Patrick Vossler:
href: https://www.patvoss.me/
navbar:
structure:
left: [reference, articles]
right: [github]
components:
github:
icon: fa-github
href: https://github.com/jacobbien/litr-project/tree/main/litr/
reference:
- title: Primary functions
desc: >
These are the functions you'll use the most.
contents:
- draft
- render
- document
- load_all
- title: Working from template
desc: >
These are functions for quickly creating different kinds of R packages.
contents:
- draft
- draft_bookdown
- draft_data
- draft_rcpp
- draft_extras
- draft_armadillo
- title: Functions for adding "extras" to your package
desc: >
These functions can help you add a README, vignettes, a pkgdown site, and a hex sticker to your package.
contents:
- add_readme
- add_vignettes
- add_pkgdown
- add_hex_sticker
- title: Custom output formats
desc: >
These are the functions for producing different output formats.
contents:
- litr_html_document
- litr_pdf_document
- litr_gitbook
- litrify_output_format
After this step, you can locally see the site by opening docs/index.html
in the browser. You can then copy the docs
directory to your website’s server and you’re done.