GitHub - sueszli/notionbackup: prettify notion html exports

2 min read Original article ↗
    _   __      __  _                ____             __
   / | / /___  / /_(_)___  ____     / __ )____ ______/ /____  ______
  /  |/ / __ \/ __/ / __ \/ __ \   / __  / __ `/ ___/ //_/ / / / __ \
 / /|  / /_/ / /_/ / /_/ / / / /  / /_/ / /_/ / /__/ ,< / /_/ / /_/ /
/_/ |_/\____/\__/_/\____/_/ /_/  /_____/\__,_/\___/_/|_|\__,_/ .___/
future-proof your notion exports                            /_/                            


HTML is the only format that can capture everything in your Notion workspace without losing information. Unlike JSON, Markdown or PDF exports, HTML can handle toggles, nested blocks, databases and embedded content.

The problem is that Notion's default HTML exports are broken in three ways: (1) they're minified so you can't edit them, (2) they need internet access to render math equations and (3) they look like generic web pages instead of Notion.

This tiny script fixes all three issues, giving you editable, offline-ready files that actually look like Notion.


┌─────────────────────┬────────────────┬──────────────────────────────┬──────────────┐
│ Export type         │ No data loss   │ Fully offline                │ Editable     │
╞═════════════════════╪════════════════╪══════════════════════════════╪══════════════╡
│ Notion API (JSON)   │ ✘              │ ✔                            │ ✔            │
│ Web scraping (HTML) │ ✘ (unreliable) │ ✘ (implementation dependent) │ ✘ (minified) │
│ PDF                 │ ✘              │ ✔                            │ ✘            │
│ Markdown            │ ✘              │ ✔                            │ ✔            │
│ HTML                │ ✔              │ ✘ (CDN dependency)           │ ✘ (minified) │
│ HTML + NotionBackup │ ✔              │ ✔                            │ ✔            │
└─────────────────────┴────────────────┴──────────────────────────────┴──────────────┘


# Usage

Export your Notion workspace as HTML with (1) everything included, (2) subpages included and (3) folders for subpages enabled.

```
uv run notionbackup.py --help

uv run notionbackup.py ./demo-data/all-blocks.zip
uv run notionbackup.py ./demo-data/blog.zip
uv run notionbackup.py ./demo-data/full-templates.zip
```