tips
How to create this note?
- Write articles by Markdown.
- Build and preview the Jupyter Book 2 site.
- Publish the generated HTML with GitHub Pages.
TL;DR
This repository uses Jupyter Book 2 / MyST. Build and preview are separate steps:
jupyter-book build --siteprepares the local site data used by the preview server.jupyter-book startstarts the local preview server.jupyter-book build --html --cigenerates static HTML under_build/htmlfor GitHub Pages.
このリポジトリは Jupyter Book 2 / MyST を使っている。build と preview は 分けて考える。
jupyter-book build --site: ローカル preview server 用の site data を生成する。jupyter-book start: ローカル preview server を起動する。jupyter-book build --html --ci: GitHub Pages へ公開する静的 HTML を_build/htmlに生成する。
Directory structure
├─ src
│ ├─ index.md
│ └─ ...
├─ myst.yml
└─ requirements.txt
Local preview
jupyter-book build --site
jupyter-book start --port 3000
Then open http://localhost:3000.
Build static HTML for publishing
BASE_URL=/jb-notes jupyter-book build --html --ci
The generated static site is written to _build/html.
Publish
Publishing is handled by GitHub Actions:
- Install Python dependencies from
requirements.txt. - Run
jupyter-book build --html --ci. - Push
_build/htmlto thegh-pagesbranch withghp-import.
This matches the current GitHub Pages setting where deployments are allowed
from the gh-pages branch.
References: