@@ -42,17 +42,77 @@ Success! 🚀
42
42
| Checkbox | ? | |
43
43
| Table Of Contents | ? | |
44
44
45
- ### Configuration
45
+ ## Usage
46
46
47
- ## Related Projects and Inspiration
47
+ At the moment ` notion-markdown-cms ` is meant to be consumed via its node.js API from build scripts
48
+ wrapping your favourite static site generator tool. You can find an example
49
+ script below. Consult the [ SyncConfig] ( ./src/SyncConfig.ts ) reference for documentation of available configuration options.
50
+
51
+ > A CLI tool could be made available later.
52
+
53
+ ``` typescript
54
+ import { SyncConfig , sync } from " notion-markdown-cms" ;
55
+
56
+ const config: SyncConfig = {
57
+ cmsDatabaseId: " 8f1de8c578fb4590ad6fbb0dbe283338" ,
58
+ outDir: " docs/" ,
59
+ indexPath: " docs/.vuepress/index.ts" ,
60
+ databases: {
61
+ " fe9836a9-6557-4f17-8adb-a93d2584f35f" : {
62
+ parentCategory: " cfmm/" ,
63
+ sorts: [
64
+ {
65
+ property: " Scope" ,
66
+ direction: " ascending" ,
67
+ },
68
+ {
69
+ property: " Cluster" ,
70
+ direction: " ascending" ,
71
+ },
72
+ ],
73
+ properties: {
74
+ category: " scope" ,
75
+ include: [" Name" , " Scope" , " Cluster" , " Journey Stage" , " Summary" ],
76
+ },
77
+ },
78
+ },
79
+ };
80
+
81
+ async function main() {
82
+ const notionApiToken = process .env .NOTION_API_TOKEN ;
83
+ if (! notionApiToken ) {
84
+ throw new Error (
85
+ " Required NOTION_API_TOKEN environment variable not provided."
86
+ );
87
+ }
88
+
89
+ await sync (notionApiToken , config );
90
+ }
91
+
92
+ main ();
93
+ ```
94
+
95
+ ## Credits, Related Projects and Inspiration
48
96
49
97
There are quite a few alternatives out there already, so why did we build ` notion-markdown-cms ` ?
50
98
Below table, albeit subjective, tries to answer this.
51
99
52
- | Project | Notion API | Language | Rendering Engine |
53
- | ------------------------------------------------------------------------ | ------------- | ---------- | ------------------- |
54
- | [ Nortion Markdown CMS] ( https://github.com/meshcloud/notion-markdown-cms ) | ✅ official | TypeScript | Markdown + JS Index |
55
- | [ Notion2GitHub] ( https://github.com/narkdown/notion2github ) | ⚠️ unofficial | Python | Markdown |
56
- | [ notion-cms] ( https://github.com/n6g7/notion-cms ) | ⚠️ unofficial | TypeScript | React |
57
- | [ vue-notion] ( https://github.com/janniks/vue-notion ) | ⚠️ unofficial | JavaScript | Vue.js |
58
- | [ react-notion] ( https://github.com/janniks/react-notion ) | ⚠️ unofficial | JavaScript | React |
100
+ | Project | Notion API | Language | Rendering Engine | Output looks like |
101
+ | ------------------------------------------------------------------------ | ------------- | ---------- | ------------------- | -------------------- |
102
+ | [ Nortion Markdown CMS] ( https://github.com/meshcloud/notion-markdown-cms ) | ✅ official | TypeScript | Markdown + JS Index | Site generator theme |
103
+ | [ Notion2GitHub] ( https://github.com/narkdown/notion2github ) | ⚠️ unofficial | Python | Markdown | Site generator theme |
104
+ | [ notion-cms] ( https://github.com/n6g7/notion-cms ) | ⚠️ unofficial | TypeScript | React | Notion App |
105
+ | [ vue-notion] ( https://github.com/janniks/vue-notion ) | ⚠️ unofficial | JavaScript | Vue.js | Notion App |
106
+ | [ react-notion] ( https://github.com/janniks/react-notion ) | ⚠️ unofficial | JavaScript | React | Notion App |
107
+
108
+ ## Development
109
+
110
+ For convenient development you can use
111
+
112
+ - ` nix-shell ` to set up a development environemnt
113
+ - You'll need a Notion database for testing. You can e.g. copy one of these to your own Notion Workspace
114
+ - [ Notion Kit Test Suite] ( https://www.notion.so/Notion-Test-Suite-067dd719a912471ea9a3ac10710e7fdf )
115
+ - [ Narkdown's Test Suite] ( https://www.notion.so/acc3dfd0339e4cacb5baae8673fddfad?v=be43c1c8dd644cfb9df9efd97d8af60a )
116
+ - A [ Notion API Token] ( https://developers.notion.com/docs/authorization )
117
+
118
+ > As this project is still in its very early stages, ` notion-markdown-cms ` does not come with its own demo, example or test cases yet.
0 commit comments