chalknotes 0.0.31 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +258 -257
  2. package/bin/cli.js +421 -390
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,257 +1,258 @@
1
- # ✏️ ChalkNotes
2
-
3
- **Turn your Notion database into a blog with zero config. Works with Next.js Page Router and App Router.**
4
-
5
- ---
6
-
7
- ## 🚀 Features
8
-
9
- - 📄 Fetch blog posts from Notion
10
- - 🪄 Auto-generate routes for App Router or Page Router
11
- - ⚙️ Helpers for `getStaticProps` / `getStaticPaths`
12
- - 🎨 Clean, responsive themes (light & dark mode)
13
- - 🔧 Interactive configuration setup
14
- - 📁 Customizable route paths
15
- - 🧠 Minimal setup – just run `chalknotes`
16
- - 🖼️ **Rich content support** - Images, code blocks, lists, quotes, and more
17
- - 🔒 **Secure rendering** - React-based component instead of raw HTML
18
-
19
- ---
20
-
21
- ## 📦 Installation
22
-
23
- ```bash
24
- pnpm add chalknotes
25
- # or
26
- npm install chalknotes
27
- ```
28
-
29
- ---
30
-
31
- ## 🧙‍♂️ Quick Start
32
-
33
- 1. **Set up environment variables**
34
- ```bash
35
- # Create .env file
36
- NOTION_TOKEN=secret_...
37
- NOTION_DATABASE_ID=xxxxxxxxxxxxxxxxxxxxxx
38
- ```
39
-
40
- 2. **Run the CLI**
41
- ```bash
42
- npx chalknotes
43
- ```
44
-
45
- 3. **That's it!** ✅
46
- - Automatically detects if you're using **App Router** or **Page Router**
47
- - Creates `blog.config.js` with default configuration (if needed)
48
- - Generates blog routes with clean, responsive templates
49
- - Supports light and dark themes
50
- - **Renders rich Notion content** with images, code blocks, and more
51
-
52
- ---
53
-
54
- ## 🔧 Configuration
55
-
56
- The CLI creates a `blog.config.js` file in your project root. Customize it to match your needs:
57
-
58
- ```javascript
59
- module.exports = {
60
- // Notion Configuration
61
- notionToken: process.env.NOTION_TOKEN,
62
- notionDatabaseId: process.env.NOTION_DATABASE_ID,
63
-
64
- // Blog Configuration
65
- routeBasePath: '/blog', // Default: '/blog'
66
- theme: 'default', // Options: 'default' (light) or 'dark'
67
- plugins: [],
68
- };
69
- ```
70
-
71
- ### Configuration Options
72
-
73
- - **`routeBasePath`**: Customize your blog route (e.g., `/posts`, `/articles`)
74
- - **`theme`**: Choose between `'default'` (light mode) or `'dark'` (dark mode)
75
- - **`plugins`**: Array for future plugin support
76
-
77
- ---
78
-
79
- ## 🎨 Themes
80
-
81
- ### Default Theme (Light Mode)
82
- - Clean white cards with subtle shadows
83
- - Light gray background
84
- - Dark text for optimal readability
85
- - Responsive design with Tailwind CSS
86
-
87
- ### Dark Theme
88
- - Dark background with gray cards
89
- - White text with proper contrast
90
- - Inverted typography for dark mode
91
- - Same responsive layout
92
-
93
- ---
94
-
95
- ## 📚 Usage in Next.js
96
-
97
- ### Page Router
98
-
99
- Creates:
100
-
101
- ```js
102
- // pages/blog/[slug].js (or custom route)
103
- import { getStaticPropsForPost, getStaticPathsForPosts } from 'chalknotes';
104
- import NotionRenderer from './NotionRenderer';
105
-
106
- export const getStaticProps = getStaticPropsForPost;
107
- export const getStaticPaths = getStaticPathsForPosts;
108
-
109
- export default function BlogPost({ post }) {
110
- return (
111
- <div className="min-h-screen bg-gray-50">
112
- <main className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
113
- <article className="bg-white rounded-lg shadow-sm border border-gray-200 p-8">
114
- <h1 className="text-4xl font-bold text-gray-900 mb-6 leading-tight">
115
- {post.title}
116
- </h1>
117
- <NotionRenderer blocks={post.blocks} />
118
- </article>
119
- </main>
120
- </div>
121
- );
122
- }
123
- ```
124
-
125
- ---
126
-
127
- ### App Router
128
-
129
- Creates:
130
-
131
- ```jsx
132
- // app/blog/[slug]/page.jsx (or custom route)
133
- import { getPostBySlug } from 'chalknotes';
134
- import NotionRenderer from './NotionRenderer';
135
-
136
- export default async function BlogPost({ params }) {
137
- const post = await getPostBySlug(params.slug);
138
-
139
- return (
140
- <div className="min-h-screen bg-gray-50">
141
- <main className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
142
- <article className="bg-white rounded-lg shadow-sm border border-gray-200 p-8">
143
- <h1 className="text-4xl font-bold text-gray-900 mb-6 leading-tight">
144
- {post.title}
145
- </h1>
146
- <NotionRenderer blocks={post.blocks} />
147
- </article>
148
- </main>
149
- </div>
150
- );
151
- }
152
- ```
153
-
154
- ---
155
-
156
- ## 🧩 API
157
-
158
- ### `getPostBySlug(slug: string)`
159
- Fetches a post and returns structured data for rendering.
160
-
161
- ```js
162
- const post = await getPostBySlug('my-post-title');
163
- // Returns: { title, slug, blocks, notionPageId }
164
- ```
165
-
166
- ---
167
-
168
- ### `getAllPosts()`
169
- Returns all published posts with metadata:
170
-
171
- ```js
172
- [
173
- {
174
- title: "My First Post",
175
- slug: "my-first-post",
176
- notionPageId: "xxxxxxxx"
177
- },
178
- ...
179
- ]
180
- ```
181
-
182
- ---
183
-
184
- ### `getStaticPropsForPost()`
185
- For use with `getStaticProps` in Page Router.
186
-
187
- ---
188
-
189
- ### `getStaticPathsForPosts()`
190
- For use with `getStaticPaths` in Page Router.
191
-
192
- ---
193
-
194
- ### `NotionRenderer`
195
- React component for rendering Notion blocks (scaffolded in your project):
196
-
197
- ```jsx
198
- import NotionRenderer from './NotionRenderer';
199
-
200
- <NotionRenderer blocks={post.blocks} />
201
- ```
202
-
203
- ---
204
-
205
- ## 🖼️ Supported Content Types
206
-
207
- The `NotionRenderer` component supports all major Notion block types:
208
-
209
- - **Text blocks**: Paragraphs, headings (H1, H2, H3)
210
- - **Lists**: Bulleted and numbered lists
211
- - **Code blocks**: With syntax highlighting support
212
- - **Images**: With captions and Next.js optimization
213
- - **Quotes**: Styled blockquotes
214
- - **Dividers**: Horizontal rules
215
- - **Rich text**: Bold, italic, strikethrough, code, links
216
-
217
- ---
218
-
219
- ## 🎨 Styling
220
-
221
- The generated templates use Tailwind CSS with:
222
- - Clean, minimal design
223
- - Responsive layout
224
- - Typography optimized for readability
225
- - Proper spacing and hierarchy
226
- - Light and dark mode support
227
- - **Rich content styling** for all Notion block types
228
-
229
- Make sure you have Tailwind CSS installed in your project:
230
-
231
- ```bash
232
- npm install -D tailwindcss @tailwindcss/typography
233
- ```
234
-
235
- ---
236
-
237
- ## 📅 Roadmap
238
-
239
- - [ ] Plugin system for custom components
240
- - [ ] More Notion block support (callouts, bookmarks, toggles)
241
- - [ ] RSS feed support
242
- - [ ] MDX or Markdown output option
243
- - [ ] Custom theme templates
244
- - [ ] Search functionality
245
- - [ ] Categories and tags support
246
-
247
- ---
248
-
249
- ## 💡 Inspiration
250
-
251
- Built to scratch an itch while exploring the simplicity of tools like [feather.so](https://feather.so/) and [Notion Blog](https://github.com/ijjk/notion-blog).
252
-
253
- ---
254
-
255
- ## 🧑‍💻 Author
256
-
257
- [NepTune](https://github.com/yourhandle) • MIT License
1
+ # ✏️ ChalkNotes
2
+
3
+ **Turn your Notion database into a blog with zero config. Works with Next.js Page Router and App Router.**
4
+
5
+ ---
6
+
7
+ ## 🚀 Features
8
+
9
+ - 📄 Fetch blog posts from Notion
10
+ - 🪄 Auto-generate routes for App Router or Page Router
11
+ - ⚙️ Helpers for `getStaticProps` / `getStaticPaths`
12
+ - 🎨 Clean, responsive themes (light & dark mode)
13
+ - 🔧 Interactive configuration setup
14
+ - 📁 Customizable route paths
15
+ - 🧠 Minimal setup – just run `chalknotes`
16
+ - 🖼️ **Rich content support** - Images, code blocks, lists, quotes, and more
17
+ - 🔒 **Secure rendering** - React-based component instead of raw HTML
18
+
19
+ ---
20
+
21
+ ## 📦 Installation
22
+
23
+ ```bash
24
+ pnpm add chalknotes
25
+ # or
26
+ npm install chalknotes
27
+ ```
28
+
29
+ ---
30
+
31
+ ## 🧙‍♂️ Quick Start
32
+
33
+ 1. **Set up environment variables**
34
+ ```bash
35
+ # Create .env file
36
+ NOTION_TOKEN=secret_...
37
+ NOTION_DATABASE_ID=xxxxxxxxxxxxxxxxxxxxxx
38
+ ```
39
+
40
+ 2. **Run the CLI**
41
+ ```bash
42
+ npx chalknotes
43
+ ```
44
+
45
+ 3. **That's it!** ✅
46
+ - Automatically detects if you're using **App Router** or **Page Router**
47
+ - Creates `blog.config.js` with default configuration (if needed)
48
+ - Generates blog routes with clean, responsive templates
49
+ - Supports light and dark themes
50
+ - **Renders rich Notion content** with images, code blocks, and more
51
+ - **Configures `next.config.js`** for unoptimized images (works with any Notion domain)
52
+
53
+ ---
54
+
55
+ ## 🔧 Configuration
56
+
57
+ The CLI creates a `blog.config.js` file in your project root. Customize it to match your needs:
58
+
59
+ ```javascript
60
+ module.exports = {
61
+ // Notion Configuration
62
+ notionToken: process.env.NOTION_TOKEN,
63
+ notionDatabaseId: process.env.NOTION_DATABASE_ID,
64
+
65
+ // Blog Configuration
66
+ routeBasePath: '/blog', // Default: '/blog'
67
+ theme: 'default', // Options: 'default' (light) or 'dark'
68
+ plugins: [],
69
+ };
70
+ ```
71
+
72
+ ### Configuration Options
73
+
74
+ - **`routeBasePath`**: Customize your blog route (e.g., `/posts`, `/articles`)
75
+ - **`theme`**: Choose between `'default'` (light mode) or `'dark'` (dark mode)
76
+ - **`plugins`**: Array for future plugin support
77
+
78
+ ---
79
+
80
+ ## 🎨 Themes
81
+
82
+ ### Default Theme (Light Mode)
83
+ - Clean white cards with subtle shadows
84
+ - Light gray background
85
+ - Dark text for optimal readability
86
+ - Responsive design with Tailwind CSS
87
+
88
+ ### Dark Theme
89
+ - Dark background with gray cards
90
+ - White text with proper contrast
91
+ - Inverted typography for dark mode
92
+ - Same responsive layout
93
+
94
+ ---
95
+
96
+ ## 📚 Usage in Next.js
97
+
98
+ ### Page Router
99
+
100
+ Creates:
101
+
102
+ ```js
103
+ // pages/blog/[slug].js (or custom route)
104
+ import { getStaticPropsForPost, getStaticPathsForPosts } from 'chalknotes';
105
+ import NotionRenderer from './NotionRenderer';
106
+
107
+ export const getStaticProps = getStaticPropsForPost;
108
+ export const getStaticPaths = getStaticPathsForPosts;
109
+
110
+ export default function BlogPost({ post }) {
111
+ return (
112
+ <div className="min-h-screen bg-gray-50">
113
+ <main className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
114
+ <article className="bg-white rounded-lg shadow-sm border border-gray-200 p-8">
115
+ <h1 className="text-4xl font-bold text-gray-900 mb-6 leading-tight">
116
+ {post.title}
117
+ </h1>
118
+ <NotionRenderer blocks={post.blocks} />
119
+ </article>
120
+ </main>
121
+ </div>
122
+ );
123
+ }
124
+ ```
125
+
126
+ ---
127
+
128
+ ### App Router
129
+
130
+ Creates:
131
+
132
+ ```jsx
133
+ // app/blog/[slug]/page.jsx (or custom route)
134
+ import { getPostBySlug } from 'chalknotes';
135
+ import NotionRenderer from './NotionRenderer';
136
+
137
+ export default async function BlogPost({ params }) {
138
+ const post = await getPostBySlug(params.slug);
139
+
140
+ return (
141
+ <div className="min-h-screen bg-gray-50">
142
+ <main className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
143
+ <article className="bg-white rounded-lg shadow-sm border border-gray-200 p-8">
144
+ <h1 className="text-4xl font-bold text-gray-900 mb-6 leading-tight">
145
+ {post.title}
146
+ </h1>
147
+ <NotionRenderer blocks={post.blocks} />
148
+ </article>
149
+ </main>
150
+ </div>
151
+ );
152
+ }
153
+ ```
154
+
155
+ ---
156
+
157
+ ## 🧩 API
158
+
159
+ ### `getPostBySlug(slug: string)`
160
+ Fetches a post and returns structured data for rendering.
161
+
162
+ ```js
163
+ const post = await getPostBySlug('my-post-title');
164
+ // Returns: { title, slug, blocks, notionPageId }
165
+ ```
166
+
167
+ ---
168
+
169
+ ### `getAllPosts()`
170
+ Returns all published posts with metadata:
171
+
172
+ ```js
173
+ [
174
+ {
175
+ title: "My First Post",
176
+ slug: "my-first-post",
177
+ notionPageId: "xxxxxxxx"
178
+ },
179
+ ...
180
+ ]
181
+ ```
182
+
183
+ ---
184
+
185
+ ### `getStaticPropsForPost()`
186
+ For use with `getStaticProps` in Page Router.
187
+
188
+ ---
189
+
190
+ ### `getStaticPathsForPosts()`
191
+ For use with `getStaticPaths` in Page Router.
192
+
193
+ ---
194
+
195
+ ### `NotionRenderer`
196
+ React component for rendering Notion blocks (scaffolded in your project):
197
+
198
+ ```jsx
199
+ import NotionRenderer from './NotionRenderer';
200
+
201
+ <NotionRenderer blocks={post.blocks} />
202
+ ```
203
+
204
+ ---
205
+
206
+ ## 🖼️ Supported Content Types
207
+
208
+ The `NotionRenderer` component supports all major Notion block types:
209
+
210
+ - **Text blocks**: Paragraphs, headings (H1, H2, H3)
211
+ - **Lists**: Bulleted and numbered lists
212
+ - **Code blocks**: With syntax highlighting support
213
+ - **Images**: With captions and Next.js optimization
214
+ - **Quotes**: Styled blockquotes
215
+ - **Dividers**: Horizontal rules
216
+ - **Rich text**: Bold, italic, strikethrough, code, links
217
+
218
+ ---
219
+
220
+ ## 🎨 Styling
221
+
222
+ The generated templates use Tailwind CSS with:
223
+ - Clean, minimal design
224
+ - Responsive layout
225
+ - Typography optimized for readability
226
+ - Proper spacing and hierarchy
227
+ - Light and dark mode support
228
+ - **Rich content styling** for all Notion block types
229
+
230
+ Make sure you have Tailwind CSS installed in your project:
231
+
232
+ ```bash
233
+ npm install -D tailwindcss @tailwindcss/typography
234
+ ```
235
+
236
+ ---
237
+
238
+ ## 📅 Roadmap
239
+
240
+ - [ ] Plugin system for custom components
241
+ - [ ] More Notion block support (callouts, bookmarks, toggles)
242
+ - [ ] RSS feed support
243
+ - [ ] MDX or Markdown output option
244
+ - [ ] Custom theme templates
245
+ - [ ] Search functionality
246
+ - [ ] Categories and tags support
247
+
248
+ ---
249
+
250
+ ## 💡 Inspiration
251
+
252
+ Built to scratch an itch while exploring the simplicity of tools like [feather.so](https://feather.so/) and [Notion Blog](https://github.com/ijjk/notion-blog).
253
+
254
+ ---
255
+
256
+ ## 🧑‍💻 Author
257
+
258
+ [NepTune](https://github.com/yourhandle) • MIT License