4. Creating documentation#
We are using Jupyter Book for creating user documentation. The contents is provided by markdown (.md) and jupyter-notebook (.ipynb) files, together with one configuration file.
Since November 2025 the current version is Jupyter Book 2, which is described first. The previous workflow with Jupyter Book 1 is kept at the end of this section.
4.1. Jupyter Book 2#
Install the python package (it brings its own JavaScript engine, Node.js is installed on demand):
pip install -U "jupyter-book>=2"
The ASC-ODE project includes a little start for the documentation in the directory docs.
For a new project, create the configuration file myst.yml by
cd docs
jupyter-book init
The file myst.yml contains the title, the authors, and the table of contents (toc) of your book.
Add a line - file: mypage.md for every page.
Preview the documentation while you are writing it:
jupyter-book start
This starts a local web server (the address is printed, usually http://localhost:3000), and updates the pages whenever you save a file.
Build the static html-documentation in _build/html:
jupyter-book build --html
4.2. Publishing on GitHub Pages: classical deployment#
A project page is served from https://<username>.github.io/<repository-name>. Thus, the site
has to know its base address, which is given by the environment variable BASE_URL:
BASE_URL=/ASC-ODE jupyter-book build --html
pip install ghp-import
ghp-import -n -p -f _build/html
ghp-import copies the html files to the branch gh-pages and pushes it to GitHub.
In the repository settings (Settings -> Pages) select this branch as the source.
On Windows (PowerShell), set the variable by $env:BASE_URL="/ASC-ODE" before building.
4.3. Publishing on GitHub Pages: GitHub Actions#
More convenient is to let GitHub build and publish the documentation after every push.
This is done by a workflow file in the directory .github/workflows of the repository,
for example .github/workflows/docs.yml:
name: Documentation
on:
push:
branches: [main]
workflow_dispatch: # allows to start it by hand in the Actions tab
env:
BASE_URL: /${{ github.event.repository.name }}
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- uses: actions/checkout@v7
- name: Setup Pages
uses: actions/configure-pages@v6
- uses: actions/setup-node@v7
with:
node-version: 24.x
- name: Install Jupyter Book
run: npm install -g jupyter-book
- name: Build HTML
run: jupyter-book build --html --strict
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: './docs/_build/html'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
ASC-ODE contains this file already. Once per repository, two settings are needed:
in a fork, enable the workflows in the Actions tab
in Settings -> Pages -> Build and deployment, select the source “GitHub Actions”
After the next push, the tab Actions shows the progress of the workflow “Documentation”,
and the documentation appears at https://<username>.github.io/ASC-ODE.
For a book in the root directory of a repository, jupyter-book init --gh-pages generates
such a workflow file.
4.4. Jupyter Book 1 (previous version)#
Install the python packages jupyter-book, and one more to work with github pages:
pip install -U "jupyter-book<2.0" ghp-import
The ASC-bla project includes a little start for the documentation. Quick steps to setup the documentation are as follows. You don’t have to do it for the bla project, files are already there.
cd docs
jupyter-book build .
This creates an html-documentation in _build/html, which you can now open in the browser.
Adapt the ‘_config.yml’ and ‘_toc.yml’ files for your project.
To publish the documentation within your own bla-project on github run
ghp-import -n -p -f _build/html