knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(fusen)
You write R scripts and you would like to share them with other users, in a sustainable and maintainable way. You already know how to write a notebook (Rmarkdown or Quarto) and share its HTML output, but you do not like to present the outputs along with how to use the functions in the same web page.
If you plan on sharing your package on GitHub, fusen::init_share_on_github()
creates all necessary files in your project and send them on your GitHub account to create the website of the package documentation.
Then, you can focus on the content.
Follow the steps below and you'll see your public website documentation in no time!
#| echo: no #| eval: no path_project <- "your/path/where/to/start/your/project/project_name" fusen::create_fusen(path = path_project, template = "minimal", with_git = TRUE, open = TRUE)
fusen::fill_description()
function with your identity as below#| eval: no # Describe your project fusen::fill_description( pkg = here::here(), fields = list( Title = "Share Your Project Following Good Development Practices From a Rmarkdown File", Description = "Use Rmarkdown First method. Strengthen your work with documentation and tests. Everything can be set from a Rmarkdown file in your project.", `Authors@R` = c( person("John", "Doe", email = "john@email.me", role = c("aut", "cre"), comment = c(ORCID = "0000-0000-0000-0000")) ) ) ) # Define License with use_*_license() usethis::use_mit_license("John Doe")
function
from the example
and test
chunksinflate()
the flat template to build the proper structure of the project#| eval: no fusen::inflate(flat_file = "dev/flat_full.Rmd", vignette_name = "Get started")
usethis::create_github_token()
, then gitcreds::gitcreds_set()
before, if you do not have a registered GitHub token yet.#| eval: no #' \dontrun{ #' # This modifies the current directory and send it on GitHub init_share_on_github() #' }
In a few minutes, you'll be able to see and share your project website.
You won't have to run this command line again.
Each time you push new commits to the main branch on GitHub, your website will be updated thanks to GitHub Actions.
init_share_on_github()
runs multiple steps to be able to share a proper package on GitHub:
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.