Book bookdown
: https://bookdown.org/yihui/bookdown/
Example books written with bookdown
: https://bookdown.org/
bookdown
install.packages("bookdown")
In RStudio:
File > New Project > New Directory > Book project using bookdown
example-book2
C:/
gitbook
Then click Build or execute
rmarkdown::render_site(encoding = 'UTF-8')
Each chapter is an R Markdown file (extension .Rmd
) and
starts with the chapter title using the first-level heading
(# Chapter Title
). By default, bookdown
merges
all .Rmd
files by the order of filenames.
index.Rmd
will be treated as the first file when merging
all files.
index.Rmd
contains the YAML header and the contents of
the homepage.
Files that start with _
are skipped.
This behavior can be overidden in the configuration file
_bookdown.yml
. More details are given here https://bookdown.org/yihui/bookdown/usage.html
Output formats: https://bookdown.org/yihui/bookdown/output-formats.html
https://bookdown.org/yihui/bookdown/github.html
/docs
Set the output directory of your book to be /docs
by
adding output_dir: "docs"
to the configuration file
_bookdown.yml
.
_bookdown.yml
: true
delete_merged_file: "docs"
output_dir:
language:
ui: "Chapter " chapter_name
In GitHub, create a repository with name
example-book
Copy SSH
git@github.com:Paula-Moraga/example-book.git
In RStudio,
File > New Project > Version Control > Git
. Copy
repository URL.
git@github.com:Paula-Moraga/example-book.git
Copy contents example-book2
to
example-book
.
Close RStudio and open example-book.Rproj
Build Book
In Terminal
git status
git add .
git commit -m "initial commit"
git push
In GitHub, go to Settings, Pages, select master
, select
/docs
, and click on Save.
Your site is ready to be published at http://www.paulamoraga.com/example-book/