Good science is based on reproducibility. Good engineering is the same; we call it testing. The following steps can be taken by a developer to rebuild the package. If you are a user, the standard instalation procedure is what you want. The testing guidance is Windows-centric, but similar steps should run on Mac or Linux.
if('Unrestricted' -ne (Get-ExecutionPolicy)) { Set-ExecutionPolicy Bypass -Scope Process -Force }
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
refreshenv
choco install r.project --version=3.6.3 -y
refreshenv
choco install r.studio --version=1.2.5033 -y
choco install rtools --version=3.5.0.4 -y
rmarkdown
(2.3), pagedown
(0.12), tinytex
(0.24), devtools
(2.3.0), roxygen2
(7.1.0), kableExtra
(1.1.0), dplyr
(1.0.0), and ggpubr
(0.3.0).roxygen2
is only needed as part of the build process.kableExtra
, rlang
, dplyr
, and ggpubr
are only used in the sample sections.
You only need them to test the inital Knit.r <- getOption('repos')
r['CRAN'] <- 'https://mran.microsoft.com/snapshot/2020-06-24'
options(repos = r)
install.packages(c('rmarkdown', 'pagedown', 'tinytex'))
install.packages(c('devtools', 'roxygen2'))
install.packages(c('kableExtra', 'dplyr', 'ggpubr'))
rstudioapi::restartSession()
tinytex::install_tinytex()
tinytex:::is_tinytex()
D:/repos/markanewman
so you may need to change the path in some of the following steps.
Downloading the zip and extracting it to D:/repos/markanewman
should also work just fine.setwd('D:/repos/markanewman')
stormdown
packagepackage <- 'stormdown'
package_path <- paste0('./', package)
unlink(paste0(package_path, c('/man', '/NAMESPACE')), recursive = T)
devtools::document(package_path)
devtools::check(package_path)
rstudioapi::restartSession()
lib <- library()
if(package %in% lib$results[,'Package']) { remove.packages(package) }
devtools::install(package_path, dep = T, upgrade = 'never')
rstudioapi::restartSession()
working_dir <- getwd()
draft_dir <- paste0(working_dir, '/draft')
if (dir.exists(draft_dir)) {
unlink(draft_dir, recursive = T)}
dir.create(draft_dir, showWarnings = F)
template_names <- c('dissertation')
for(i in 1:length(template_names)) {
dir.create(paste0(draft_dir, '/t', i), showWarnings = F)}
for(i in 1:length(template_names)) {
rmarkdown::draft(
paste0(draft_dir, '/t', i, '/', template_names[i]),
template = template_names[i],
package = package,
create_dir = F,
edit = F)}
for(i in 1:length(template_names)) {
setwd(paste0(draft_dir, '/t', i))
env_t <- new.env()
rmarkdown::render(paste0(template_names[i], '.rmd'), envir = env_t)
}
exists <- T
for(i in 1:length(template_names)) {
exists <- exists & file.exists(paste0(draft_dir, '/t', i, '/', template_names[i], '.html'))}
exists
setwd(working_dir)
unlink(draft_dir, recursive = T)
rm(list=ls())
rstudioapi::restartSession()
if('Unrestricted' -ne (Get-ExecutionPolicy)) { Set-ExecutionPolicy Bypass -Scope Process -Force }
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
refreshenv
choco install docker-desktop -y
D:/repos
so you may need to change the path in some of the following steps.d:
cd d:/repos/markanewman/stormdown
docker build -t stormdown:local .
docker run --name my_stormdown stormdown:local
docker cp my_stormdown:/draft/t1/dissertation.html dissertation.html
docker rm my_stormdown
docker rmi stormdown:local
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.