No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-22 10:28:23 -07:00
.envrc Initial commit 2026-07-21 12:19:22 -07:00
notion-to-gitbook.py Image conversion 2026-07-22 10:28:23 -07:00
poetry.lock Initial commit 2026-07-21 12:19:22 -07:00
pyproject.toml Initial commit 2026-07-21 12:19:22 -07:00
README.md Add pbcopy 2026-07-21 12:40:59 -07:00

Notion to Gitbook

Our workflow requires you to write everything in Notion, then copy-paste it to GitBook. This is a bad workflow. This script aims to ease the transfer from Notion to GitBook.

Installation

  1. Create and activate a virtualenv however you like
  2. python -m pip install .

Usage

  1. In Notion, navigate to ... (upper right), then "Export".
  2. Set Export format to "HTML". The other options don't matter.
  3. Unzip the resulting download to get a directory containing your Notion page in HTML.
  4. Run notion-to-gitbook.py /path/to/downloaded/notion/. Note this is the dir, not the HTML file.
  5. Tell Rich about any bugs.

If you're on a mac, you can run cat gitbook.html | pbcopy to copy the result straight to your clipboard.

Why

This script has a few advantages:

  • Create empty image blocks with the caption pre-entered, so you can just upload the image rather than create one yourself
  • De-duplicate figure captions
  • Detect and semi-format math (can't full format b/c of GitBook bug)
  • Correctly convert Notion callouts to GitBook callouts