nconv-cli 1.0.0 → 1.0.3
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/.claude/settings.local.json +7 -1
- package/GITHUB_ABOUT.md +53 -0
- package/README.md +285 -131
- package/dist/index.js +1036 -40
- package/dist/index.js.map +1 -1
- package/nconv-cli-1.0.0.tgz +0 -0
- package/nconv-cli-1.0.2.tgz +0 -0
- package/nconv-cli-1.0.3.tgz +0 -0
- package/package.json +23 -10
- package/patches/notion-exporter+0.8.1.patch +32 -0
- package/src/commands/html.ts +135 -0
- package/src/commands/init.ts +55 -0
- package/src/commands/md.ts +0 -4
- package/src/commands/pdf.ts +150 -0
- package/src/config.ts +105 -13
- package/src/core/exporter.ts +159 -2
- package/src/index.ts +52 -3
- package/src/repl/commands.ts +535 -0
- package/src/repl/index.ts +87 -0
- package/src/repl/prompts.ts +123 -0
- package/src/utils/logger.ts +5 -5
- package/test/test-export-types.ts +54 -0
- package/test/test-markdown.ts +45 -0
- package/test/test-pdf.ts +44 -0
- package/test-output/drf-serializer/drf-serializer.pdf +0 -0
- package/test-output/drf-serializer/images/Untitled-1.png +0 -0
- package/test-output/drf-serializer/images/Untitled.png +0 -0
- package/README.en.md +0 -200
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
"Bash(chmod:*)",
|
|
7
7
|
"Bash(npm run build:*)",
|
|
8
8
|
"Bash(npm link:*)",
|
|
9
|
-
"Bash(notion-convertor:*)"
|
|
9
|
+
"Bash(notion-convertor:*)",
|
|
10
|
+
"Bash(npm install:*)",
|
|
11
|
+
"Bash(npm uninstall:*)",
|
|
12
|
+
"Bash(npx patch-package:*)",
|
|
13
|
+
"Bash(npx tsx:*)",
|
|
14
|
+
"Bash(node dist/index.js:*)",
|
|
15
|
+
"Bash(npm info:*)"
|
|
10
16
|
]
|
|
11
17
|
}
|
|
12
18
|
}
|
package/GITHUB_ABOUT.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# GitHub About / Description
|
|
2
|
+
|
|
3
|
+
## English
|
|
4
|
+
|
|
5
|
+
### Short (160 characters max - for GitHub About field)
|
|
6
|
+
```
|
|
7
|
+
A CLI tool to convert Notion pages into blog-ready Markdown, HTML, and PDF with automatic image handling and beautiful formatting
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Alternative (shorter)
|
|
11
|
+
```
|
|
12
|
+
Convert Notion pages to Markdown, HTML, PDF with auto image processing - ready to publish
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Tags/Topics
|
|
16
|
+
```
|
|
17
|
+
notion
|
|
18
|
+
markdown
|
|
19
|
+
html
|
|
20
|
+
pdf
|
|
21
|
+
converter
|
|
22
|
+
cli
|
|
23
|
+
blog
|
|
24
|
+
exporter
|
|
25
|
+
typescript
|
|
26
|
+
notion-api
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 한국어
|
|
32
|
+
|
|
33
|
+
### Short (GitHub About용)
|
|
34
|
+
```
|
|
35
|
+
Notion 페이지를 블로그용 Markdown, HTML, PDF로 변환하는 CLI 도구 (이미지 자동 처리 및 아름다운 포맷팅)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Alternative (짧은 버전)
|
|
39
|
+
```
|
|
40
|
+
Notion을 Markdown, HTML, PDF로 변환 - 이미지 자동 처리, 즉시 게시 가능
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Key Differentiators (vs notion-exporter)
|
|
46
|
+
|
|
47
|
+
**nconv-cli advantages:**
|
|
48
|
+
- ✅ Multiple formats: Markdown + HTML + PDF (notion-exporter: MD + CSV only)
|
|
49
|
+
- ✅ Perfect image handling: Local download + base64 embed in PDF (notion-exporter: no image processing)
|
|
50
|
+
- ✅ Blog-ready structure: Post-level directories (notion-exporter: flat export)
|
|
51
|
+
- ✅ Interactive TUI: Slash commands interface (notion-exporter: CLI only)
|
|
52
|
+
- ✅ Beautiful PDF: GitHub-styled with embedded images (notion-exporter: no PDF)
|
|
53
|
+
- ✅ Zero post-processing: Ready to publish (notion-exporter: requires manual organization)
|
package/README.md
CHANGED
|
@@ -1,196 +1,350 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
<p align="center">
|
|
3
|
+
<a href="#-nconv-cli-english">English</a> | <a href="#-nconv-cli-한국어">한국어</a>
|
|
3
4
|
</p>
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
---
|
|
6
7
|
|
|
7
|
-
>
|
|
8
|
-
> (이미지 자동 추출 및 경로 정리 포함)
|
|
8
|
+
<div id="-nconv-cli-english">
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
이미지 파일을 로컬로 추출해 블로그 친화적인 구조로 정리해주는 CLI 도구입니다.
|
|
10
|
+
# 🚀 nconv-cli (Notion Converter CLI)
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
> **Faster Workflow**: A CLI tool that automatically convert Notion pages into Markdown, HTML, and PDF.
|
|
13
|
+
> Stop wasting time unzipping files and fixing broken image paths manually.
|
|
14
14
|
|
|
15
|
-
- 🚀 Notion 퍼블릭 페이지를 블로그용 마크다운으로 바로 변환
|
|
16
|
-
- 🖼️ 이미지 파일을 로컬로 자동 다운로드 및 상대경로로 변환
|
|
17
|
-
- 📁 게시글 단위로 정리된 출력 디렉토리 구조
|
|
18
|
-
- 🎨 간단한 CLI 인터페이스
|
|
19
15
|
|
|
16
|
+
---
|
|
20
17
|
|
|
18
|
+
## 1. Quick Start
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
Choose your preferred way to work: **Interactive TUI** for easy setup or **Direct CLI** for speed.
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
단순한 복사/붙여넣기나 기본 Markdown export는 포스팅에 불편함이 있습니다.
|
|
22
|
+
### **Option A: Interactive TUI (Recommended for First-time)**
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
* 마크다운 식으로 텍스트는 변환되지만,
|
|
29
|
-
* 이미지는 Notion CDN URL로 유지되며
|
|
30
|
-
* Access Denied 로 이미지 접근이 깨지는 경우가 많습니다
|
|
24
|
+
Enter a Claude Code-style shell to manage settings and convert multiple pages easily.
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
```bash
|
|
27
|
+
# 1. Install globally
|
|
28
|
+
npm install -g nconv-cli
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
# 2. Enter Interactive Mode
|
|
31
|
+
nconv
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| **nconv-cli** | ✅ 로컬 자동 추출 | ✅ 즉시 사용 가능 |
|
|
33
|
+
# 3. Setup environment & Convert (Inside TUI)
|
|
34
|
+
nconv> /init # Set your Notion tokens (Required once)
|
|
35
|
+
nconv> /md <URL> # Convert Notion page to Markdown
|
|
36
|
+
nconv> /pdf <URL> # Convert Notion page to PDF
|
|
44
37
|
|
|
45
|
-
|
|
38
|
+
```
|
|
46
39
|
|
|
47
|
-
|
|
48
|
-
- Notion 이미지 CDN 문제로 글이 깨져본 경험이 있는 분
|
|
49
|
-
- 노션 문서 체계를 옵시디언 등으로 마이그레이션하기 원하시는 분
|
|
40
|
+
### **Option B: Direct CLI**
|
|
50
41
|
|
|
42
|
+
Instantly convert pages with one line. Perfect for scripts and automation.
|
|
51
43
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
```bash
|
|
45
|
+
# Basic Markdown conversion
|
|
46
|
+
nconv md "https://notion.so/your-page-url"
|
|
55
47
|
|
|
56
|
-
|
|
48
|
+
nconv md "URL"
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
npm install
|
|
50
|
+
# Generate a professional GitHub-style PDF
|
|
51
|
+
nconv pdf "URL"
|
|
61
52
|
|
|
62
|
-
#
|
|
63
|
-
|
|
53
|
+
# Advanced: Save to ./blog as 'my-post.md' with images in 'assets'
|
|
54
|
+
nconv md "URL" -o ./blog -f my-post -i assets
|
|
55
|
+
|
|
56
|
+
# Bulk Conversion: Convert multiple links at once using a simple shell loop
|
|
57
|
+
urls=("URL_1" "URL_2" "URL_3")
|
|
58
|
+
for url in "${urls[@]}"; do nconv md "$url" -o ./dist; done
|
|
64
59
|
|
|
65
|
-
# 로컬에 CLI 설치
|
|
66
|
-
npm link
|
|
67
60
|
```
|
|
68
61
|
|
|
69
|
-
##
|
|
62
|
+
## 2. Configuration & Requirements
|
|
63
|
+
|
|
64
|
+
* **Public Page (Required)**: Your Notion page must be **"Published to web"** (Share -> Publish).
|
|
65
|
+
* **Tokens**: Run `nconv init` to set `TOKEN_V2` and `FILE_TOKEN` (found in your browser's notion.so cookies).
|
|
66
|
+
|
|
67
|
+
### How to Find Your Notion Tokens
|
|
68
|
+
|
|
69
|
+
1. Log in to [notion.so](https://notion.so) in your browser.
|
|
70
|
+
2. Open your browser's developer tools (usually F12).
|
|
71
|
+
3. Go to the "Application" tab.
|
|
72
|
+
4. Select `https://www.notion.so` under the "Cookies" section.
|
|
73
|
+
5. Copy the value of the `token_v2` cookie and paste it into the `TOKEN_V2` field.
|
|
74
|
+
6. Copy the value of the `file_token` cookie and paste it into the `FILE_TOKEN` field.
|
|
75
|
+
|
|
76
|
+
## 3. Core Features
|
|
77
|
+
|
|
78
|
+
- ⚡️ **Faster Workflow**: Creates a ready-to-publish structure with automatic image downloads and relative path conversion.
|
|
79
|
+
- 🎨 **Multi-format Support**:
|
|
80
|
+
- **Markdown**: Optimized for static site generators (Hugo, Jekyll) and tech blogs (Velog, Tistory).
|
|
81
|
+
- **HTML**: Perfect for quick web sharing and style previews.
|
|
82
|
+
- **PDF**: Clean, professional archiving with GitHub-style CSS formatting.
|
|
83
|
+
- 🖼️ **Smart Image Handling**:
|
|
84
|
+
- **Markdown/HTML**: Extracts images locally and auto-updates internal paths.
|
|
85
|
+
- **PDF**: Encodes all images to **Base64** to prevent resource loss within a single file.
|
|
86
|
+
- ✨ **Zero Manual Work**: No more manual renaming or fixing broken image paths.
|
|
87
|
+
- 💬 **Interactive TUI**: Provides a **Claude Code style** slash command interface.
|
|
88
|
+
- 📁 **Better Organization**: Automatically creates separate folders for each document title.
|
|
89
|
+
## 4. Why nconv-cli?
|
|
90
|
+
|
|
91
|
+
| | Copy & Paste | Default Export | **nconv-cli** |
|
|
92
|
+
| --- | --- | --- | --- |
|
|
93
|
+
| **Images** | ❌ Broken Links | ⚠️ Manual Cleanup | **✅ Auto Download** |
|
|
94
|
+
| **Paths** | ❌ Manual Fix | ⚠️ Manual Fix | **✅ Auto Fix** |
|
|
95
|
+
| **Speed** | ❌ Slow | ⚠️ Annoying | **🚀 Fast & Easy** |
|
|
96
|
+
|
|
97
|
+
## 5. Recommended For
|
|
98
|
+
|
|
99
|
+
- Users who write in Notion and post to **Velog, Tistory, GitHub Pages, Hugo, and more**.
|
|
100
|
+
- Users who have experienced broken images due to Notion's private CDN issues.
|
|
101
|
+
- Those migrating their Notion workspace to tools like **Obsidian, Bear, etc**.
|
|
102
|
+
|
|
103
|
+
## 6. Advanced TUI Usage (Interactive)
|
|
104
|
+
|
|
105
|
+
The interactive mode (`nconv`) allows for more flexible control.
|
|
106
|
+
|
|
107
|
+
* **Check Configuration & Get Help**:
|
|
108
|
+
```bash
|
|
109
|
+
nconv> /config # View current settings like TOKEN_V2.
|
|
110
|
+
nconv> /help # See all available slash commands.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
* **Convert with Options**:
|
|
114
|
+
In addition to basic commands, you can specify options like output directory (`-o`) and filename (`-f`).
|
|
115
|
+
```bash
|
|
116
|
+
# Save Markdown to './blog' as 'my-post.md'
|
|
117
|
+
nconv> /md <URL> -o ./blog -f my-post
|
|
118
|
+
|
|
119
|
+
# Save PDF to './docs' as 'my-doc.pdf'
|
|
120
|
+
nconv> /pdf <URL> -o ./docs -f my-doc
|
|
121
|
+
```
|
|
70
122
|
|
|
71
|
-
|
|
123
|
+
## 7. Advanced CLI Usage (Direct)
|
|
124
|
+
|
|
125
|
+
The CLI mode is powerful for scripting and automation. Combine options for fine-grained control.
|
|
126
|
+
|
|
127
|
+
### CLI Options
|
|
128
|
+
|
|
129
|
+
| Option | Short | Description | Default |
|
|
130
|
+
|--------|-------|-------------|---------|
|
|
131
|
+
| `--output <dir>` | `-o` | Output directory | `./nconv-output` |
|
|
132
|
+
| `--image-dir <dir>` | `-i` | Image folder name (relative to output) | `images` |
|
|
133
|
+
| `--filename <name>` | `-f` | Output filename (without extension) | Extracted from URL |
|
|
134
|
+
| `--verbose` | `-v` | Enable verbose logging | `false` |
|
|
135
|
+
|
|
136
|
+
### CLI Combination Examples
|
|
72
137
|
|
|
73
138
|
```bash
|
|
74
|
-
# .
|
|
75
|
-
|
|
139
|
+
# 1. HTML: Save to './web-dist' as 'index.html' with images in 'img'
|
|
140
|
+
nconv html "URL" -o ./web-dist -f index -i img
|
|
141
|
+
|
|
142
|
+
# 2. PDF: Save to './documents' as 'report.pdf' and enable verbose logs
|
|
143
|
+
nconv pdf "URL" -o ./documents -f report -v
|
|
144
|
+
|
|
145
|
+
# 3. Markdown (All Options): Save to './blog' as 'post-1.md' with images in 'assets'
|
|
146
|
+
nconv md "URL" -o ./blog -i assets -f "post-1" -v
|
|
76
147
|
```
|
|
77
148
|
|
|
78
|
-
|
|
149
|
+
## 8. For Developers
|
|
150
|
+
|
|
151
|
+
### **Project Structure**
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
src/
|
|
155
|
+
├── core/ # Notion export & Image logic
|
|
156
|
+
├── commands/ # CLI command definitions
|
|
157
|
+
├── repl/ # Interactive TUI mode
|
|
158
|
+
└── utils/ # File & Logger helpers
|
|
79
159
|
|
|
80
160
|
```
|
|
81
|
-
|
|
82
|
-
|
|
161
|
+
|
|
162
|
+
### **Contribution**
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
git clone https://github.com/itsme-shawn/nconv-cli.git
|
|
166
|
+
npm install
|
|
167
|
+
npm link
|
|
168
|
+
npm run dev
|
|
169
|
+
|
|
83
170
|
```
|
|
84
171
|
|
|
85
|
-
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
<br>
|
|
177
|
+
<p align="center">
|
|
178
|
+
<a href="#-nconv-cli-english">English</a> | <a href="#-nconv-cli-한국어">한국어</a>
|
|
179
|
+
</p>
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
<div id="-nconv-cli-한국어">
|
|
86
184
|
|
|
87
|
-
|
|
88
|
-
2. 브라우저 개발자 도구 열기 (F12)
|
|
89
|
-
3. Application > Cookies > notion.so
|
|
90
|
-
4. `token_v2` 값 복사 → `.env`의 `TOKEN_V2`에 붙여넣기
|
|
91
|
-
5. `file_token` 값 복사 → `.env`의 `FILE_TOKEN`에 붙여넣기
|
|
185
|
+
# 🚀 nconv-cli (Notion Converter CLI)
|
|
92
186
|
|
|
93
|
-
|
|
187
|
+
> 노션 페이지를 CLI 도구를 통해 Markdown, HTML, PDF로 자동 변환합니다.
|
|
188
|
+
> 수동으로 압축을 풀거나 깨진 이미지 경로를 수정하는 시간을 단축해줍니다.
|
|
94
189
|
|
|
95
|
-
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## 1. 빠른 시작 (Quick Start)
|
|
193
|
+
|
|
194
|
+
쉬운 설정을 위한 **대화형 TUI** 또는 빠른 작업을 위한 **CLI 직접 명령** 중 하나를 선택하세요.
|
|
195
|
+
|
|
196
|
+
### **Option A: 대화형 TUI (처음 사용자 권장)**
|
|
197
|
+
|
|
198
|
+
설정을 관리하고 여러 페이지를 쉽게 변환할 수 있는 Claude Code 스타일의 쉘에 진입합니다.
|
|
96
199
|
|
|
97
200
|
```bash
|
|
98
|
-
|
|
201
|
+
# 1. 전역 설치
|
|
202
|
+
npm install -g nconv-cli
|
|
203
|
+
|
|
204
|
+
# 2. 대화형 모드 진입
|
|
205
|
+
nconv
|
|
206
|
+
|
|
207
|
+
# 3. 환경 설정 및 변환 (TUI 내부)
|
|
208
|
+
nconv> /init # 노션 토큰 설정 (최초 1회 필수)
|
|
209
|
+
nconv> /md <URL> # 노션 페이지를 마크다운으로 변환
|
|
210
|
+
nconv> /pdf <URL> # 노션 페이지를 PDF로 변환
|
|
211
|
+
|
|
99
212
|
```
|
|
100
213
|
|
|
101
|
-
###
|
|
214
|
+
### **Option B: CLI 직접 명령**
|
|
215
|
+
|
|
216
|
+
스크립트 작성이나 자동화에 최적화되어 있습니다.
|
|
102
217
|
|
|
103
218
|
```bash
|
|
104
|
-
# 기본
|
|
105
|
-
nconv md "https://notion.so
|
|
219
|
+
# 기본 마크다운 변환
|
|
220
|
+
nconv md "https://notion.so/페이지-URL"
|
|
106
221
|
|
|
107
|
-
#
|
|
108
|
-
nconv md "
|
|
222
|
+
# 마크다운 변환 실행
|
|
223
|
+
nconv md "URL"
|
|
109
224
|
|
|
110
|
-
#
|
|
111
|
-
nconv
|
|
225
|
+
# GitHub 스타일의 깔끔한 PDF 생성
|
|
226
|
+
nconv pdf "URL"
|
|
112
227
|
|
|
113
|
-
#
|
|
114
|
-
nconv md "
|
|
228
|
+
# 고급설정: ./blog 폴더에 'my-post.md'로 저장하고 이미지는 'assets'에 수집
|
|
229
|
+
nconv md "URL" -o ./blog -f my-post -i assets
|
|
230
|
+
|
|
231
|
+
# 벌크 처리: 여러 링크를 한 번에 처리 (쉘 루프 활용)
|
|
232
|
+
urls=("URL_1" "URL_2" "URL_3")
|
|
233
|
+
for url in "${urls[@]}"; do nconv md "$url" -o ./dist; done
|
|
115
234
|
|
|
116
|
-
# 모든 옵션 사용
|
|
117
|
-
nconv md "https://notion.so/My-Page-abc123" -o ./blog -i assets -f "article-1" -v
|
|
118
235
|
```
|
|
119
236
|
|
|
120
|
-
##
|
|
237
|
+
## 2. 설정 및 주의사항
|
|
121
238
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
| `--output <dir>` | `-o` | 출력 디렉토리 | `./output` |
|
|
125
|
-
| `--image-dir <dir>` | `-i` | 이미지 폴더명 (output 기준 상대경로) | `images` |
|
|
126
|
-
| `--filename <name>` | `-f` | 출력 파일명 (확장자 제외 또는 포함) | URL에서 자동 추출 |
|
|
127
|
-
| `--verbose` | `-v` | 상세 로그 출력 | `false` |
|
|
239
|
+
* **공개 페이지 설정 (필수)**: 변환하려는 노션 페이지는 반드시 **"웹에 게시"** 상태여야 합니다 (공유 -> 게시).
|
|
240
|
+
* **토큰 설정**: `nconv init`을 실행하여 `TOKEN_V2`와 `FILE_TOKEN`을 설정하세요 (브라우저의 notion.so 쿠키에서 확인 가능).
|
|
128
241
|
|
|
129
|
-
|
|
242
|
+
### Notion 토큰 값 확인하는 방법
|
|
130
243
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
├── def67890.jpg
|
|
138
|
-
└── ...
|
|
139
|
-
```
|
|
244
|
+
1. 브라우저에서 [notion.so](https://notion.so)에 로그인합니다.
|
|
245
|
+
2. 브라우저 개발자 도구(보통 F12)를 엽니다.
|
|
246
|
+
3. "Application" 탭으로 이동합니다.
|
|
247
|
+
4. "Cookies" 섹션에서 `https://www.notion.so`를 선택합니다.
|
|
248
|
+
5. `token_v2` 쿠키 값을 복사하여 `TOKEN_V2` 필드에 붙여넣습니다.
|
|
249
|
+
6. `file_token` 쿠키 값을 복사하여 `FILE_TOKEN` 필드에 붙여넣습니다.
|
|
140
250
|
|
|
141
|
-
|
|
251
|
+
## 3. 주요 특징
|
|
142
252
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
253
|
+
* ⚡️ **워크플로우 단축**: 이미지 자동 다운로드 및 상대 경로 변환을 통해 즉시 게시 가능한 구조를 생성합니다.
|
|
254
|
+
* 🎨 **멀티 포맷 지원**:
|
|
255
|
+
* **Markdown**: 정적 사이트 생성기(Hugo, Jekyll) 및 기술 블로그(Velog, Tistory) 최적화.
|
|
256
|
+
* **HTML**: 빠른 웹 공유 및 스타일 확인용.
|
|
257
|
+
* **PDF**: GitHub 스타일 CSS가 적용된 깔끔한 배포/아카이빙용 문서.
|
|
258
|
+
|
|
259
|
+
* 🖼️ **지능형 이미지 처리**:
|
|
260
|
+
* **Markdown/HTML**: 이미지를 로컬로 추출하고 문서 내 경로를 자동 업데이트합니다.
|
|
261
|
+
* **PDF**: 모든 이미지를 **Base64**로 인코딩하여 단일 파일 내에 포함합니다 (리소스 유실 방지).
|
|
262
|
+
* ✨ **수동 작업 최소화**: 파일명 변경이나 깨진 이미지 경로 수정 등 반복적인 작업이 필요 없습니다.
|
|
263
|
+
* 💬 **인터랙티브 TUI**: **Claude Code 스타일**의 슬래시 커맨드 인터페이스를 제공합니다.
|
|
264
|
+
* 📁 **체계적 관리**: 문서 제목별로 독립된 폴더 구조를 자동으로 생성합니다.
|
|
265
|
+
|
|
266
|
+
## 4. Why nconv-cli?
|
|
267
|
+
|
|
268
|
+
| 비교 항목 | 단순 복사 & 붙여넣기 | 노션 기본 내보내기 | **nconv-cli** |
|
|
269
|
+
| --- | --- | --- | --- |
|
|
270
|
+
| **이미지 관리** | ❌ 링크 깨짐 발생 | ⚠️ 수동 정리 필요 | **✅ 로컬 자동 추출** |
|
|
271
|
+
| **경로 설정** | ❌ 수동 수정 필요 | ⚠️ 수동 재설정 필요 | **✅ 경로 자동 최적화** |
|
|
272
|
+
| **작업 속도** | ❌ 매우 느림 | ⚠️ 번거로운 프로세스 | **🚀 매우 빠르고 간편** |
|
|
273
|
+
|
|
274
|
+
## 5. 이런 분들에게 추천합니다
|
|
275
|
+
|
|
276
|
+
* 노션으로 글을 쓰고 **Velog, Tistory, GitHub Pages, Hugo 등**에 포스팅하는 개발자.
|
|
277
|
+
* 노션 전용 이미지 CDN 문제로 블로그 이미지가 깨져본 경험이 있는 분.
|
|
278
|
+
* 노션 문서 체계를 **Obsidian, Bear 등**의 도구로 마이그레이션하려는 분.
|
|
279
|
+
|
|
280
|
+
## 6. TUI 고급 사용법 (대화형)
|
|
281
|
+
|
|
282
|
+
`nconv`를 실행하면 나오는 대화형 모드에서는 더 많은 옵션을 활용할 수 있습니다.
|
|
146
283
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- **dotenv**: 환경 변수 관리
|
|
153
|
-
- **chalk**: 터미널 출력 색상화
|
|
154
|
-
- **ora**: 터미널 스피너 (진행 상황 표시)
|
|
155
|
-
- **slugify**: 문자열을 URL 슬러그로 변환
|
|
156
|
-
- **uuid**: 고유 ID 생성
|
|
284
|
+
* **설정 확인 및 도움말 보기**:
|
|
285
|
+
```bash
|
|
286
|
+
nconv> /config # 현재 TOKEN_V2 등 설정 값을 확인합니다.
|
|
287
|
+
nconv> /help # 사용 가능한 모든 명령어를 봅니다.
|
|
288
|
+
```
|
|
157
289
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
290
|
+
* **옵션을 포함한 변환**:
|
|
291
|
+
Quick Start에서 소개된 기본 변환 외에도, 출력 경로(`-o`), 파일명(`-f`) 등을 자유롭게 지정할 수 있습니다.
|
|
292
|
+
```bash
|
|
293
|
+
# 마크다운을 'blog' 폴더에 'my-post.md'로 저장
|
|
294
|
+
nconv> /md <URL> -o ./blog -f my-post
|
|
161
295
|
|
|
162
|
-
|
|
296
|
+
# PDF를 'docs' 폴더에 'my-doc.pdf'로 저장
|
|
297
|
+
nconv> /pdf <URL> -o ./docs -f my-doc
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## 7. CLI 고급 사용법 (직접 명령)
|
|
301
|
+
|
|
302
|
+
### CLI 옵션
|
|
303
|
+
|
|
304
|
+
| 옵션 | 단축 | 설명 | 기본값 |
|
|
305
|
+
|---|---|---|---|
|
|
306
|
+
| `--output <dir>` | `-o` | 결과물이 저장될 폴더 | `./nconv-output` |
|
|
307
|
+
| `--image-dir <dir>` | `-i` | 이미지가 저장될 폴더 (output 폴더 기준 상대 경로) | `images` |
|
|
308
|
+
| `--filename <name>` | `-f` | 확장자를 제외한 파일명 | 페이지 URL에서 추출 |
|
|
309
|
+
| `--verbose` | `-v` | 상세 로그를 출력 | `false` |
|
|
310
|
+
|
|
311
|
+
### CLI 조합 예시
|
|
163
312
|
|
|
164
313
|
```bash
|
|
165
|
-
#
|
|
166
|
-
|
|
314
|
+
# 1. HTML 변환: 'web-dist' 폴더에 'index.html'로 저장하고 이미지 폴더는 'img'로 지정
|
|
315
|
+
nconv html "URL" -o ./web-dist -f index -i img
|
|
167
316
|
|
|
168
|
-
#
|
|
169
|
-
|
|
317
|
+
# 2. PDF 변환: 'documents' 폴더에 'report.pdf'로 저장하고 상세 로그 출력
|
|
318
|
+
nconv pdf "URL" -o ./documents -f report -v
|
|
170
319
|
|
|
171
|
-
#
|
|
172
|
-
|
|
173
|
-
nconv md "
|
|
320
|
+
# 3. 마크다운 변환: 모든 옵션 조합
|
|
321
|
+
# './blog' 폴더 아래 'assets'에 이미지를 저장하고 'post-1.md'로 결과물 생성
|
|
322
|
+
nconv md "URL" -o ./blog -i assets -f "post-1" -v
|
|
174
323
|
```
|
|
175
324
|
|
|
176
|
-
##
|
|
325
|
+
## 8. 개발자를 위한 안내
|
|
326
|
+
|
|
327
|
+
### **프로젝트 구조**
|
|
328
|
+
|
|
329
|
+
```text
|
|
330
|
+
src/
|
|
331
|
+
├── core/ # 노션 내보내기 및 이미지 처리 핵심 로직
|
|
332
|
+
├── commands/ # CLI 명령어 정의 (init, md, html 등)
|
|
333
|
+
├── repl/ # 인터랙티브 TUI 모드 구현부
|
|
334
|
+
└── utils/ # 파일 시스템 및 로거 유틸리티
|
|
177
335
|
|
|
178
336
|
```
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
│ └── utils/
|
|
189
|
-
│ ├── file.ts # 파일 유틸리티
|
|
190
|
-
│ └── logger.ts # 로깅
|
|
191
|
-
├── bin/
|
|
192
|
-
│ └── nconv.js # 실행 파일
|
|
193
|
-
├── package.json
|
|
194
|
-
├── tsconfig.json
|
|
195
|
-
└── tsup.config.ts
|
|
337
|
+
|
|
338
|
+
### **기여 방법**
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
git clone https://github.com/itsme-shawn/nconv-cli.git
|
|
342
|
+
npm install
|
|
343
|
+
npm link
|
|
344
|
+
npm run dev
|
|
345
|
+
|
|
196
346
|
```
|
|
347
|
+
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
|