BiocBook
is a package to facilitate the creation of
package-based, versioned online books. Such books can be used in a variety
of contexts, including extended technical documentation (e.g. of an ecosystem
based on multiple packages) or online workshops.
BiocBook
assists authors in:
- Writing: compile a body of biological and/or bioinformatics knowledge;
- Containerizing: provide Docker images (through GitHub) to reproduce the examples illustrated in the compendium;
- Publishing: let Bioconductor or Github deploy an online book to disseminate the compendium;
- Versioning: automatically generate specific online book versions and Docker images for specific Bioconductor releases.
Main features of BiocBook
s
BiocBook
s created with the {BiocBook
} package and hosted on GitHub
are deployed and served on the gh-pages
branch and a Docker image is available
on ghcr.io.
BiocBook
s created with the {BiocBook
} package and submitted to Bioconductor
are directly available for reading from the Bioconductor website.
Read the BiocBookDemo
example book to know more about BiocBook
s features.
Creating a BiocBook
A new BiocBook
should be created using the init(new_package = "...")
function.
This function performs the following operations:
- It checks that the provided package name is available;
- It logs in the GitHub user accounts;
- It creates a new remote Github repository using the
BiocBook.template
from js2264/BiocBook
;
- It sets up Github Pages to serve the future books from the
gh-pages
branch;
- It clones the remote Github repository to a local folder;
- It edits several placeholders from the template and commits the changes.
library(BiocBook)
init("myNewBook", .local = TRUE)
! Dummy git configured
• git user: `dummy`
• git email: `dummy@dummy.com`
! No GitHub configured
• github user: NULL
• PAT: NULL
✔ Filled out `inst/assets/_book.yml` fields
✔ Filled out `README.md` fields
✔ Filled out `DESCRIPTION` fields
ℹ Please finish editing the `DESCRIPTION` fields, including:
• Title
• Description
• Authors@R
✔ Filled out `inst/index.qmd` fields
ℹ Please finish editing the `inst/index.qmd` fields, including the `Welcome` section
ℹ The following files need to be committed:
The BiocBook
class
A BiocBook
object acts as a pointer to a local package directory, with
book chapters contained in a pages/
folder as .qmd
files.
bb <- BiocBook("myNewBook")
bb
Editing an existing BiocBook
BiocBook
objects can be modified using the following helper functions:
add_preamble(biocbook)
to start writing a preamble;
add_chapter(biocbook, title = "...")
to start writing a new chapter;
edit_page(biocbook, page = "...")
to edit an existing chapter.
add_preamble(bb, open = FALSE)
add_chapter(bb, title = 'Chapter 1', open = FALSE)
bb
preview(biocbook)
will compile (and cache) the book locally. Use it
to verify that your book renders correctly.
Publishing an existing BiocBook
As long as the local BiocBook
has been initiated with init()
,
the writer simply has to commit changes and push them to the origin
remote.
In R
, this can be done as follows:
The different available versions published in the origin
gh-pages
branch
can be listed using status(biocbook)
.