Helpfeel Cosense (Scrapbox) to Notion Migration Tool
pip install sb2n
# or, (use as CLI only)
pipx install sb2nCreate a .env file in your project directory. (See: .env.example)
Create a database in Notion with the following properties:
- Title (Title) - Page title
- Scrapbox URL (URL) - Link to original Scrapbox page
- Created Date (Date) - Original creation date
- Tags (Multi-select) - Tags from Scrapbox
# Basic migration (using .env file)
sb2n migrate
# Specify custom .env file
sb2n migrate --env-file /path/to/.env
# Specify credentials directly via command line options
sb2n migrate -P your-project -S your-sid -N secret_token -D database-id
# Mix .env and options (options take precedence)
sb2n migrate --env-file .env -P override-project
# Dry run (no actual changes)
sb2n migrate --dry-run
# Migrate only first 10 pages
sb2n migrate -n 10
# Skip pages that already exist in Notion
sb2n migrate --skip
# Combine options: dry run with limit and skip existing
sb2n migrate --dry-run -n 5 --skip
# Enable verbose logging
sb2n -v migrate-P, --project: Scrapbox project name (overridesSCRAPBOX_PROJECTin .env)-S, --sid: Scrapbox connect.sid cookie (overridesSCRAPBOX_COOKIE_CONNECT_SIDin .env)-N, --ntn: Notion integration token (overridesNOTION_API_KEYin .env)-D, --db: Notion database ID (overridesNOTION_DATABASE_IDin .env)--env-file: Path to .env file (default:.env)-v, --verbose: Enable verbose logging
Note: When both .env and command line options are specified, command line options take precedence.
After migration, restore Scrapbox internal links ([PageName] format) to actual Notion page mentions:
# Restore links in all pages
sb2n restore-link
# Dry run (preview changes without applying)
sb2n restore-link --dry-run
# Restore links in specific pages only
sb2n restore-link --pages "HomePage,Getting Started"
# Enable verbose logging
sb2n -v restore-linkExport Scrapbox pages to Markdown format with downloaded images. Images are saved in an assets/ directory and referenced with relative paths in the Markdown files.
# Export to default directory (./out)
sb2n export
# Specify output directory
sb2n export -d /path/to/output
# Limit number of pages to export
sb2n export --limit 10
# Combine options
sb2n export -d ./my-export --limit 5
# Export as plain Scrapbox format
sb2n export --f txt
# Enable verbose logging
sb2n -v exportoutput-dir/project-name/
├── assets/ # Downloaded images
│ ├── abc123def456.png
│ ├── 789ghijk012.jpg
│ └── ...
├── page1.md # Markdown files
├── page2.md
└── ...
See docs/specification.md for detailed specifications.
