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.
- package/README.md +258 -257
- package/bin/cli.js +421 -390
- 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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
- **`
|
75
|
-
- **`
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
import
|
105
|
-
|
106
|
-
|
107
|
-
export const
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
import
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
- **
|
211
|
-
- **
|
212
|
-
- **
|
213
|
-
- **
|
214
|
-
- **
|
215
|
-
- **
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
-
|
224
|
-
-
|
225
|
-
-
|
226
|
-
-
|
227
|
-
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
- [ ]
|
241
|
-
- [ ]
|
242
|
-
- [ ]
|
243
|
-
- [ ]
|
244
|
-
- [ ]
|
245
|
-
- [ ]
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
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
|