knitr::opts_chunk$set( collapse = FALSE, comment = "", fig.path = "man/figures/README-", out.width = "100%" )
tldrExample exports several simple functions (multiply()
, divide()
, ...) with
tldr-style documentation:
Looking at /R/multiply.R
, we can see how tldr
documentation files are created:
readLines(here::here("R/multiply.R")) |> cat(sep = "\n")
tldr_roclet()
from tldr
creates .Rd files based on relevant tags in the Roxygen skeleton (including the new @paramtldr
and @exampletldr
).
These .Rd files are written to the /inst/tldr/
directory.
Once the package is installed, tldr:::tldr_help()
and tldr:::tldr_package()
are able to find the relevant files which are turned into console output by tldr:::Rd2tldr()
.
This process is inspired by the help()
function---for those who are interested, I have a
blog post
in which I go through how ?
and help()
work in detail.
tldr and tldrExample are both in very early stages and are not suitable for use as tools by R users and developers. That being said, if you are interested in installing them you can install the development versions from GitHub with:
# install.packages("devtools") devtools::install_github("jamesotto852/tldr") devtools::install_github("jamesotto852/tldrExample")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.