noblog 0.1.1 → 0.2.0-beta
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 +169 -48
- package/dist/generate.cjs +404 -184
- package/dist/generate.cjs.map +1 -1
- package/dist/generate.js +405 -185
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/{nomd → noblog}/format.d.ts +1 -16
- package/dist/lib/noblog/format.d.ts.map +1 -0
- package/dist/lib/noblog/noblog.d.ts +31 -0
- package/dist/lib/noblog/noblog.d.ts.map +1 -0
- package/dist/lib/noblog/utils.d.ts +36 -0
- package/dist/lib/noblog/utils.d.ts.map +1 -0
- package/dist/lib/notion/client.d.ts +4 -12
- package/dist/lib/notion/client.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/lib/nomd/format.d.ts.map +0 -1
- package/dist/lib/nomd/nomd.d.ts +0 -32
- package/dist/lib/nomd/nomd.d.ts.map +0 -1
- package/dist/lib/nomd/utils.d.ts +0 -6
- package/dist/lib/nomd/utils.d.ts.map +0 -1
- package/dist/lib/notion/object.d.ts +0 -148
- package/dist/lib/notion/object.d.ts.map +0 -1
- package/dist/lib/notion/request.d.ts +0 -36
- package/dist/lib/notion/request.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,87 +1,208 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 📝 Noblog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Transform your Notion content into beautiful static blogs with Astro
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://badge.fury.io/js/noblog)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Noblog generates static content from Notion databases and provides a pluggable component/theme marketplace for bloggers. Inspired by [notablog](https://github.com/dragonman225/notablog) but more flexible thanks to the power of Astro.
|
|
8
9
|
|
|
10
|
+
## 🆚 Why Noblog vs notion-to-md?
|
|
11
|
+
|
|
12
|
+
While Noblog uses [notion-to-md](https://github.com/souvikinator/notion-to-md) under the hood, it provides significant improvements for blog generation:
|
|
13
|
+
|
|
14
|
+
### 🔧 **Enhanced Markdown Generation**
|
|
15
|
+
|
|
16
|
+
**Problem with notion-to-md:**
|
|
17
|
+
When dealing with complex formatting like nested styles (e.g., `{BLOCK1}` and `{BLOCK2}` both bold, but only `BLOCK1` also italic), notion-to-md generates malformed markdown:
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
_**BLOCK1**_**BLOCK2** # Broken: unmerged tags
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Noblog's Solution:**
|
|
24
|
+
|
|
25
|
+
- **Merged Tag Handling**: Properly merges nested formatting tags
|
|
26
|
+
- **Clean Markdown Output**: Generates valid, renderer-friendly markdown
|
|
27
|
+
- **Astro-Optimized**: Specifically designed for static site generation
|
|
28
|
+
|
|
29
|
+
### 🏗️ **Complete Blog Structure**
|
|
30
|
+
|
|
31
|
+
**notion-to-md:** Just converts pages to markdown
|
|
32
|
+
|
|
33
|
+
**Noblog:**
|
|
34
|
+
|
|
35
|
+
- ✅ Automatic file structure generation
|
|
36
|
+
- ✅ Parent/child page organization
|
|
37
|
+
- ✅ Astro-compatible frontmatter
|
|
38
|
+
- ✅ Customizable save paths
|
|
39
|
+
- ✅ Layout path customization
|
|
40
|
+
- ✅ Theme marketplace ready
|
|
41
|
+
|
|
42
|
+
### ⚡ **One-Command Solution**
|
|
43
|
+
|
|
44
|
+
Instead of manually handling notion-to-md output and building your own file structure:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# With Noblog - everything handled automatically
|
|
48
|
+
noblog --layout ../../layouts/BlogLayout.astro
|
|
49
|
+
|
|
50
|
+
# With notion-to-md - you'd need to build everything yourself
|
|
9
51
|
```
|
|
52
|
+
|
|
53
|
+
> **Note:** Noblog includes improvements to notion-to-md's core parsing logic, fixing edge cases like unmerged formatting tags that can break markdown renderers.
|
|
54
|
+
|
|
55
|
+
## 🚀 Quick Start
|
|
56
|
+
|
|
57
|
+
### Installation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
10
60
|
npm install -g noblog
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Basic Usage
|
|
64
|
+
|
|
65
|
+
```bash
|
|
11
66
|
noblog
|
|
12
67
|
```
|
|
13
68
|
|
|
14
|
-
|
|
69
|
+
That's it! Noblog will fetch your Notion content and generate static markdown files.
|
|
70
|
+
|
|
71
|
+
### 🛠️ Command-Line Options
|
|
15
72
|
|
|
16
|
-
|
|
73
|
+
Noblog supports various command-line options to customize your blog generation:
|
|
17
74
|
|
|
18
|
-
|
|
75
|
+
```bash
|
|
76
|
+
# Basic usage with default settings
|
|
77
|
+
noblog
|
|
19
78
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
NOTION_API_SECRET: your notion api secret.
|
|
23
|
-
```
|
|
79
|
+
# Custom layout path
|
|
80
|
+
noblog --layout ../../layouts/BlogLayout.astro
|
|
24
81
|
|
|
25
|
-
|
|
82
|
+
# Custom save and sub paths with layout
|
|
83
|
+
noblog ./content/blog/ ./content/blog/subpages/ --layout ../../../layouts/CustomLayout.astro
|
|
26
84
|
|
|
27
|
-
|
|
85
|
+
# Verbose output for debugging
|
|
86
|
+
noblog -v
|
|
87
|
+
# or
|
|
88
|
+
noblog --verbose
|
|
89
|
+
```
|
|
28
90
|
|
|
29
|
-
|
|
91
|
+
**Available Options:**
|
|
30
92
|
|
|
31
|
-
|
|
93
|
+
- `--layout PATH` - Custom layout path relative to the posts directory (default: `../../layouts/MarkdownPostLayout.astro`)
|
|
94
|
+
- `-v, --verbose` - Print more messages for debugging
|
|
95
|
+
- `-h, --help` - Show help message
|
|
96
|
+
- `--version` - Show version information
|
|
32
97
|
|
|
33
|
-
|
|
98
|
+
**Positional Arguments:**
|
|
34
99
|
|
|
100
|
+
- `SAVE_PATH` - Directory to save main posts (default: `./src/pages/posts/`)
|
|
101
|
+
- `SUB_PATH` - Subdirectory for nested content (default: `nob_children/`)
|
|
102
|
+
|
|
103
|
+
## 📋 Setup Guide
|
|
104
|
+
|
|
105
|
+
### 1. Create Your Notion Database
|
|
106
|
+
|
|
107
|
+
Duplicate this [template database](https://www.notion.so/humbornjo/fa0faae85c504934a4a86cfa70302850?v=2abd1079ae134fbd8df2604765baa1df) and start writing your blog posts in Notion.
|
|
108
|
+
|
|
109
|
+
### 2. Configure Environment Variables
|
|
110
|
+
|
|
111
|
+
Set up your Notion API credentials:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
export NOBLOG_DATABASE_ID="your-notion-database-id"
|
|
115
|
+
export NOTION_API_SECRET="your-notion-api-secret"
|
|
35
116
|
```
|
|
36
|
-
project root
|
|
37
|
-
└──src
|
|
38
|
-
└── pages
|
|
39
|
-
└── posts
|
|
40
|
-
├── blog_1.md
|
|
41
|
-
├── blog_2.md
|
|
42
|
-
└── nob_children
|
|
43
|
-
├── referenced_blog_1.md
|
|
44
|
-
├── referenced_blog_2.md
|
|
45
|
-
├── referenced_blog_3.md
|
|
46
|
-
├── referenced_blog_4.md
|
|
47
|
-
└── referenced_blog_5.md
|
|
48
|
-
```
|
|
49
117
|
|
|
50
|
-
|
|
118
|
+
### 3. Choose a Template
|
|
119
|
+
|
|
120
|
+
Pick an Astro template that supports Noblog. Here's a starter template: **[nobloger](https://github.com/humbornjo/nobloger)**
|
|
121
|
+
|
|
122
|
+
### 4. Deploy Your Site
|
|
123
|
+
|
|
124
|
+
Run `noblog` to generate your content, then deploy your Astro site to your preferred hosting platform.
|
|
125
|
+
|
|
126
|
+
## 📁 File Structure
|
|
127
|
+
|
|
128
|
+
By default, Noblog organizes your content like this:
|
|
51
129
|
|
|
52
130
|
```
|
|
53
|
-
|
|
131
|
+
project-root/
|
|
132
|
+
└── src/
|
|
133
|
+
└── pages/
|
|
134
|
+
└── posts/
|
|
135
|
+
├── blog-post-1.md # Direct database entries
|
|
136
|
+
├── blog-post-2.md
|
|
137
|
+
└── nob_children/
|
|
138
|
+
├── sub-post-1.md # Referenced/child pages
|
|
139
|
+
├── sub-post-2.md
|
|
140
|
+
└── sub-post-3.md
|
|
54
141
|
```
|
|
55
142
|
|
|
56
|
-
|
|
143
|
+
### Custom Save Paths
|
|
144
|
+
|
|
145
|
+
You can customize the output directories:
|
|
57
146
|
|
|
147
|
+
```bash
|
|
148
|
+
noblog <SAVE_PATH> <SUB_PATH>
|
|
149
|
+
|
|
150
|
+
# Example:
|
|
151
|
+
noblog ./content/blog/ ./content/blog/subpages/
|
|
58
152
|
```
|
|
153
|
+
|
|
154
|
+
## 🎯 Markdown Output
|
|
155
|
+
|
|
156
|
+
Generated markdown files include Astro-compatible frontmatter:
|
|
157
|
+
|
|
158
|
+
```markdown
|
|
59
159
|
---
|
|
60
160
|
layout: ../../layouts/MarkdownPostLayout.astro
|
|
61
|
-
title: "
|
|
62
|
-
tags: ["
|
|
161
|
+
title: "Your Blog Post Title"
|
|
162
|
+
tags: ["tag1", "tag2", "tag3"]
|
|
63
163
|
pubDate: 2024-01-24
|
|
64
164
|
archived: false
|
|
65
|
-
description: "
|
|
165
|
+
description: "Your post description here"
|
|
66
166
|
---
|
|
167
|
+
|
|
168
|
+
# Your content starts here...
|
|
67
169
|
```
|
|
68
170
|
|
|
69
|
-
|
|
171
|
+
## 🔧 Requirements
|
|
172
|
+
|
|
173
|
+
**Any Astro template can be used with Noblog!** The only requirement is that your template includes a layout component.
|
|
70
174
|
|
|
71
|
-
|
|
175
|
+
This means you can use:
|
|
176
|
+
|
|
177
|
+
- ✅ Any existing Astro blog template
|
|
178
|
+
- ✅ Your custom Astro theme
|
|
179
|
+
- ✅ Popular Astro themes from the community
|
|
180
|
+
- ✅ The starter template: **[nobloger](https://github.com/humbornjo/nobloger)**
|
|
181
|
+
|
|
182
|
+
### Layout Customization
|
|
183
|
+
|
|
184
|
+
By default, Noblog uses `../../layouts/MarkdownPostLayout.astro` as the layout path. You can customize this using the `--layout` option:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Use a custom layout
|
|
188
|
+
noblog --layout ../../layouts/BlogLayout.astro
|
|
189
|
+
|
|
190
|
+
# Use with custom save paths
|
|
191
|
+
noblog ./content/blog/ ./content/blog/subpages/ --layout ../../../layouts/CustomLayout.astro
|
|
192
|
+
```
|
|
72
193
|
|
|
73
|
-
|
|
194
|
+
**Important:** The layout path is relative to the posts directory where your markdown files are saved. For example:
|
|
195
|
+
- If your save path is `./src/pages/posts/`, the default layout path `../../layouts/MarkdownPostLayout.astro` points to `./src/layouts/MarkdownPostLayout.astro`
|
|
196
|
+
- If you change the save path to `./content/blog/`, you might need `--layout ../../layouts/CustomLayout.astro` to point to `./content/layouts/CustomLayout.astro`
|
|
74
197
|
|
|
75
|
-
|
|
76
|
-
- \[2024.07.20\] generate github flavored markdown
|
|
77
|
-
- \[2024.09.04\] at least it worked
|
|
198
|
+
Adjust the layout path based on where your Astro layout files are located relative to your posts directory.
|
|
78
199
|
|
|
79
|
-
|
|
200
|
+
## 🙏 Acknowledgments
|
|
80
201
|
|
|
81
|
-
|
|
202
|
+
Built upon the excellent work of these projects:
|
|
82
203
|
|
|
83
|
-
- [
|
|
84
|
-
- [
|
|
85
|
-
- [notion-to-md](https://github.com/souvikinator/notion-to-md)
|
|
86
|
-
- [notablog](https://github.com/dragonman225/notablog)
|
|
87
|
-
- [astro-notion-blog](https://github.com/otoyo/astro-notion-blog)
|
|
204
|
+
- [Notion API](https://developers.notion.com/reference/intro) - Official Notion API documentation
|
|
205
|
+
- [Notion SDK](https://developers.notion.com/docs/getting-started) - Notion's official SDK
|
|
206
|
+
- [notion-to-md](https://github.com/souvikinator/notion-to-md) - Notion to Markdown converter
|
|
207
|
+
- [notablog](https://github.com/dragonman225/notablog) - Original inspiration
|
|
208
|
+
- [astro-notion-blog](https://github.com/otoyo/astro-notion-blog) - Astro + Notion integration
|