Skip to content

Commit 1b65b28

Browse files
🦆
1 parent fc036a3 commit 1b65b28

File tree

1 file changed

+139
-1
lines changed

1 file changed

+139
-1
lines changed

packages/notion-compat/readme.md

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,145 @@
44

55
# notion-compat
66

7-
TODO
7+
> A compatibility layer between the official Notion API and the unofficial Notion API
8+
9+
## Features
10+
11+
- fully compatible with `react-notion-x`
12+
- backwards compatible with `notion-client` and the unofficial notion API
13+
14+
## Usage
15+
16+
```ts
17+
import { Client } from '@notionhq/client'
18+
import { NotionCompatAPI } from 'notion-compat'
19+
20+
const notion = new NotionCompatAPI(
21+
new Client({ auth: process.env.NOTION_TOKEN })
22+
)
23+
24+
const recordMap = await notion.getPage(pageId)
25+
```
26+
27+
The resulting `recordMap` is compatible with notion's unofficial API and react-notion-x.
28+
29+
## Demo
30+
31+
You can preview `react-notion-x` using the official client and compatibility layer here: https://react-notion-x-official-api-demo.transitivebullsh.it/
32+
33+
## Status
34+
35+
Many blocks aren't displayed properly (sometimes in subtle ways) because Notion's official API doesn't contain enough formatting info for us to faithfully render content, so I recommend checking out [the notion-compat demo](https://react-notion-x-official-api-demo.transitivebullsh.it/) side-by-side with the [normal react-notion-x demo](https://react-notion-x-demo.transitivebullsh.it/) (which uses the unofficial Notion API via `notion-client`) and/or the [equivalent public notion page](https://transitive-bs.notion.site/Notion-Kit-Test-Suite-067dd719a912471ea9a3ac10710e7fdf).
36+
37+
The main thing feature from `notion-compat` right now feature-wise is collection (database) support.
38+
39+
Note that using the official API with `notion-compat` is quite a bit slower than using the unofficial API via `notion-client` because of [reasons](https://github.com/NotionX/react-notion-x/issues/269#issuecomment-1100648873).
40+
41+
## Block Compatibility
42+
43+
### Summary of Known Issues 🔴
44+
45+
- image, video, and embed blocks are missing `format` for proper sizing and layout
46+
- 3492bd6dbaf44fe7a5cac62c5d402f06
47+
- 5d4e290ca4604d8fb809af806a6c1749
48+
- image, video, and embed blocks are missing `caption`
49+
- 912379b0c54440a286619f76446cd753
50+
- embed blocks don't contain enough info for proper embedding
51+
- have to write custom embedding logic for iframe urls
52+
- same with some video blocks
53+
- 5d4e290ca4604d8fb809af806a6c1749
54+
- `alias` blocks fail for links pointing to other workspaces
55+
- this happens even if the linked page is publicly readable
56+
- 034119d20132420abe8e9863bbe91e9d
57+
- rich text mentions fail for links to pages and databases in other workspaces
58+
- if API integration doesn't have access to the workspace
59+
- this happens even if the linked page is publicly readable
60+
- 52353862df0f48ba85648db7d0acd1dd
61+
- format `toggleable` is missing
62+
- no toggle headers
63+
- 5995506f2c564d81956aa38711e12337
64+
65+
### Blocks with Full Compatibility 🟢
66+
67+
- paragraph (`text` block)
68+
- heading_1 (`header` block)
69+
- heading_2 (`sub_header` block)
70+
- heading_3 (`sub_sub_header` block)
71+
- bulleted_list_item (`bulleted_list` block)
72+
- numbered_list_item (`numbered_list` block)
73+
- quote
74+
- to_do
75+
- toggle
76+
- code
77+
- callout
78+
- file
79+
- divider
80+
- table_of_contents
81+
- column_list
82+
- column
83+
- equation (block and inline)
84+
- synced_block (`transclusion_container` and `transclusion_reference`)
85+
- audio
86+
- tweet
87+
88+
### Blocks with Partial Compatibility 🟡
89+
90+
- bookmark
91+
- images and content are missing
92+
- 0be6efce9daf42688f65c76b89f8eb27
93+
- image
94+
- missing caption
95+
- missing format so sizing and layout aren't always handled properly
96+
- 912379b0c54440a286619f76446cd753
97+
- video
98+
- missing caption
99+
- missing format so sizing and layout aren't always handled properly
100+
- missing embedding logic in some cases (original URL must be transformed for embedding in many cases)
101+
- 5d4e290ca4604d8fb809af806a6c1749
102+
- embed
103+
- missing caption
104+
- missing format so sizing and layout aren't always handled properly
105+
- missing embedding logic
106+
- original URL must be transformed for embedding in many cases
107+
- missing embeding display size hints from embedly
108+
- 5d4e290ca4604d8fb809af806a6c1749
109+
- this goes for custom embed blocks as well
110+
- maps
111+
- figma
112+
- typeform
113+
- codepen
114+
- excalidraw
115+
- gist
116+
- loom
117+
- drive
118+
- ...
119+
- child_page (`page` block)
120+
- page format missing entirely
121+
- no full width, fonts, font size, etc
122+
- 72c5d33ca46642feaee06852cc57c588
123+
- 3702a5d6403d4d58b8a944a77ca26c70
124+
- page cover missing `page_cover_position`
125+
- 067dd719a912471ea9a3ac10710e7fdf
126+
- link_to_page (`alias` block)
127+
- missing for links pointing to other workspaces, even if they're publicly readable
128+
- 034119d20132420abe8e9863bbe91e9d
129+
- pdf
130+
- missing format so sizing and layout aren't handled properly
131+
132+
### Blocks that are WIP 🚧
133+
134+
- child_database (`collection_view` and `collection_view_page` blocks)
135+
- table and table_row (simple table blocks)
136+
137+
### Blocks that are Not Supported 🔴
138+
139+
- external_object_instance
140+
141+
### Blocks that I'm not sure how to handle
142+
143+
- breadcrumb
144+
- template
145+
- unsupported
8146

9147
## License
10148

0 commit comments

Comments
 (0)