This is a short overview of the major components and steps in building a Jupyter Book. See the other pages in this guide for more in-depth information.
The Jupyter Book command-line interface¶
Jupyter Book uses a command-line interface to perform a variety of actions. For example, building and cleaning books. You can run the following command to see what options are at your control:
Usage: jupyter-book [OPTIONS] COMMAND [ARGS]... Build and manage books with Jupyter. Options: --version Show the version and exit. -h, --help Show this message and exit. Commands: build Convert your book's or page's content to HTML or a PDF. clean Empty the _build directory except jupyter_cache. config Inspect your _config.yml file. create Create a Jupyter Book template that you can customize. myst Manipulate MyST markdown files. toc Command-line for sphinx-external-toc.
For more complete information about the CLI, see The command-line interface.
The book building process¶
Building a Jupyter Book broadly consists of these steps:
Create your book’s content. You structure your book with a collection of folders, files, and configuration. See Anatomy of a Jupyter Book.
Build your book. Using Jupyter Book’s command-line interface you can convert your pages into either an HTML or a PDF book. See Build your book.
Publish your book online. Once your book is built, you can share it with others. Most common is to build HTML, and host it as a public website. See Publish your book online.
Anatomy of a Jupyter Book¶
There are three things that you need in order to build a Jupyter Book:
A configuration file (
A table of contents file (
Your book’s content
For example, consider the following folder structure, which makes up a simple Jupyter Book.
mybookname/ ├── _config.yml ├── _toc.yml ├── landing-page.md └── page1.ipynb
We’ll cover each briefly below, and you can find more information about them elsewhere in this documentation.
Book configuration (
All of the configuration for your book is in a YAML file called
You can define metadata for your book (such as its title), add a book logo, turn on different “interactive” buttons (such as a Binder button for pages built from a Jupyter Notebook), and more.
Here’s an example of a simple
# in _config.yml title: "My book title" logo: images/logo.png execute: execute_notebooks: "off"
title:defines a title for the book. It will show up in the left sidebar.
logo:defines a path to an image file for your book’s logo (it will also show up in the sidebar).
execute:contains a collection of configuration options to control execution and cacheing.
execute_notebooks: "off"tells Jupyter Book not to execute any computational content that it finds when building the book. By default, Jupyter Book executes and caches all book content.
Table of Contents (
Jupyter Book uses your Table of Contents to define the structure of your book. For example, your chapters, sub-chapters, etc.
This is a YAML file with a collection of pages, each one linking to a file in your book. Here’s an example of the two content files shown above.
# In _toc.yml - file: landing-page - file: page1
Each item in the
_toc.yml file points to a single file. The links
should be relative to your book’s folder and with no extension.
Think of the top-most level of your TOC file as book chapters (excluding the landing page). The title of each chapter will be inferred from the title in your files.
The first file specifies the landing page of your book (in this case, it is a markdown file). The landing page is the highest page in your book’s content hierarchy. The second file specifies a content page of your book (in this case, it is a Jupyter Notebook).
You can specify more complex book configurations with your
_toc.yml file. For example, you can specify parts, sections, and control custom titles. For more information about your book’s table of contents file, see Structure your book’s pages.
A collection of text files make up your book’s content. These can be one of several types of files, such as markdown (
.md), Jupyter Notebooks (
.ipynb) or reStructuredText (
.rst) files (see Types of content source files for a full list).
In the above example, there were two files listed: a markdown file and a Jupyter Notebook. We’ll cover each in the next section.