Once you've added content and configured your book, it's time to
build the HTML for each page of your book. We'll use the
jupyter-book build command-line tool for this. In the next step,
we'll stitch these HTML pages into a book.
In order to build the HTML for each page, you should have followed the steps
in creating your Jupyter Book structure. You should have
a Jupyter Book structure in a local folder on your computer, a collection
of notebook/markdown files in your
content/ folder, a
that defines the structure of your book, and any configuration you'd like
Now that your book's content is in the
content/ folder and you've
defined your book's structure in
_data/toc.yml, you can build
the HTML for each page of your book.
Do so by running the following command:
jupyter-book build mybookname/
- Use the links specified in the
_data/toc.ymlfile (pointing to files in
/content/) and do the following:
nbconvertto turn the content files (e.g.,
.md, etc) files into HTML
- Replace relative image file paths so that they work on your new built book
- Place all these generated files in the
After this step is finished, you should have a collection of HTML files in your
By default, Jupyter Book will only build the HTML for pages that have
been updated since the last time you built the book. This helps reduce the
amount of unnecessary time needed to build your book. If you'd like to
force Jupyter Book to re-build a particular page, you can either edit the
corresponding file in the
content/ folder, or delete that page's HTML
You've created your book on your own computer, but you haven't yet added it online. This section covers the steps to create your own GitHub repository, and to add your book's content to it. In this case, we'll use GitHub-Pages to build the HTML for your book. However, you can also build the book's HTML manually. Both will be covered in building and publishing your book.
First, log-in to GitHub, then go to the "create a new repository" page:
Next, add a name and description for your book. You can choose whatever initialization you'd like.
Now, clone the empty repository to your computer:
git clone https://github.com/<my-org>/<my-book-name>
Copy all of your book files and folders (what was created when you ran
jupyter-book create mybook) into the new repository. For example, if you created your book locally with
jupyter-book create mylocalbookand your online repository is called
myonlinebook, the command would be:
cp -r mylocalbook/* myonlinebook/
This will copy over the local book files into the online book folder.
Commit the new files to the repository in
cd myonlinebook git add ./* git commit -m "adding my first book!" git push
Now that you've created the HTML for each page of your book, it's time to stitch them together into a book. That's covered in the next section.