This lesson gives you a head start in creating your own online book using GitHub and the template repository JB2_book_template.
Set up your own repository¶
Follow these instruction to use this template for your own book.
Go to this repository
Click the green button
use this template
and clickcreate a new repository
.Choose a proper name of your repository (this will be also part of your URL!) and choose the option
public
.In your repository, click on
settings
and in the left menu on Pages and chooseGithub actions
Figure 1:Follow these steps to create your own repository from the template.
Click on
code
and click on thegear-icon
(near About) at the right site of the page.Check the box Use your GitHub Pages website.
Go to
actions
in the topmenu, click on the (red)initial commit
and clickre-run all jobs
The book will now be deployed again - where now it can actually load GitHub pages.
Figure 2:Follow these steps to create your own GHpages from the template.
Use the book link (
code
below About) to your Github page where the book is hosted.The output resembles Figure 3.

Figure 3:Once the book has been deploy, you can visit your site which looks like this.
Repo folder structure¶
Your GitHub repository looks like the one shown in Figure 4. We have the following subfolders:
Content: the source files of your book (in markdown or jupyter notebook format)
Exports: the folder which may include a pdf export of your book
Figures: the folder which includes figures for your book (could be in content folder)
Lessons: the folder which includes the lessons of this tutorial (could be in Content folder)
.github/workflows: the folder which includes the GitHub actions (automated workflows) to build and deploy your book
css: the folder which includes the custom css file to change the layout of your book
pdf_template_book: the folder which includes the typst template to create a pdf export of your book

Figure 4:Once the book has been deploy, you can visit your site which looks like this.
Make and deploy changes¶
You have a number of options for making changes to the book’s source and seeing how they affect the output.
It is possible to work directly in the GitHub environment: no need to install anything as this is already covered with the GH actions that we created.
Click on the index.md file in the Content folder
Click on the drop down icon next to the pencil icon and choose
open in github.dev
This will start the GitHub development environment where you can edit the files directly in your browser.Edit the file by replacing the names with your own and commit your changes, see Figure 5
Figure 5:Working directly in the GitHub development environment.
Now, if you go back to your repository and click on actions
you will see that the workflow is running to build and deploy your book. After a few minutes, you can refresh your book page and see your changes live!
You can also make changes locally then push them back to your GitHub repository.
Clone the repository to your local machine using Git.
git clone git@github.com:<github_user_name>/JB2_book_template.git
Make changes to the content files in the
content
directory using your text editor.Commit and push your changes. For example
git commit -a
git push -u origin main
Now, if you go back to your repository and click on actions
you will see that the workflow is running to build and deploy your book. After a few minutes, you can refresh your book page and see your changes live!
If you prefer, you can also work entirely locally using command-line tools and a text editor.
Clone the repository to your local machine using Git.
git clone git@github.com:<github_user_name>/JB2_book_template.git
Install MyST Markdown. Using
npm
orpip
npm install -g mystmd
pip install mystmd
Make changes to the content files in the
content
directory using your text editor.Serve the book locally.
myst start
Preview the book in your browser at
http://localhost:3000
Create a pdf export¶
A clear advantage of JB2 over JB1 is the ability to easily create a high quality pdf export of your book (as well as other formats). We included a GitHb action that automatically creates a pdf export of your book using Typst when you push changes to your repository. You can also create the pdf locally if you have the Typst CLI installed. We cover the pdf export later in more detail