markdown-to-document-cli 1.0.0
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/LICENSE +21 -0
- package/README.md +281 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +335 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index.js.map +1 -0
- package/dist/services/ContentValidator.d.ts +50 -0
- package/dist/services/ContentValidator.d.ts.map +1 -0
- package/dist/services/ContentValidator.js +385 -0
- package/dist/services/ContentValidator.js.map +1 -0
- package/dist/services/MarkdownPreprocessor.d.ts +29 -0
- package/dist/services/MarkdownPreprocessor.d.ts.map +1 -0
- package/dist/services/MarkdownPreprocessor.js +168 -0
- package/dist/services/MarkdownPreprocessor.js.map +1 -0
- package/dist/services/PandocService.d.ts +82 -0
- package/dist/services/PandocService.d.ts.map +1 -0
- package/dist/services/PandocService.js +285 -0
- package/dist/services/PandocService.js.map +1 -0
- package/dist/types/index.d.ts +105 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/validators.d.ts +31 -0
- package/dist/types/validators.d.ts.map +1 -0
- package/dist/types/validators.js +5 -0
- package/dist/types/validators.js.map +1 -0
- package/dist/utils/common.d.ts +19 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/common.js +73 -0
- package/dist/utils/common.js.map +1 -0
- package/dist/utils/constants.d.ts +24 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +156 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/fileUtils.d.ts +17 -0
- package/dist/utils/fileUtils.d.ts.map +1 -0
- package/dist/utils/fileUtils.js +70 -0
- package/dist/utils/fileUtils.js.map +1 -0
- package/dist/utils/markdownUtils.d.ts +27 -0
- package/dist/utils/markdownUtils.d.ts.map +1 -0
- package/dist/utils/markdownUtils.js +171 -0
- package/dist/utils/markdownUtils.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 잘생김프로쌤
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# Markdown to Document CLI
|
|
2
|
+
|
|
3
|
+
> 🚀 전문 출판 수준의 EPUB/PDF 변환 도구
|
|
4
|
+
|
|
5
|
+
마크다운 문서를 **완벽한 품질의 EPUB/PDF**로 변환하는 CLI 도구입니다. 옵시디언 플러그인 "Markdown to Document Pro"의 핵심 기능을 NPM/NPX 패키지로 제공합니다.
|
|
6
|
+
|
|
7
|
+
## ✨ 주요 기능
|
|
8
|
+
|
|
9
|
+
### 📚 핵심 변환 기능
|
|
10
|
+
- **EPUB 3.3 / PDF** 형식 지원
|
|
11
|
+
- **4가지 타이포그래피 프리셋** (소설, 발표, 리뷰, 전자책)
|
|
12
|
+
- **자동 목차 생성** (계층형 네비게이션)
|
|
13
|
+
- **챕터별 파일 분리** (H1 기준)
|
|
14
|
+
|
|
15
|
+
### 🔍 8개 검증 모듈 (자동 수정)
|
|
16
|
+
1. **Frontmatter 검증**: YAML 구문 오류 자동 수정
|
|
17
|
+
2. **제목 검증**: H1 중복 감지, 레벨 갭 수정
|
|
18
|
+
3. **링크 검증**: Obsidian 링크 자동 변환 (`[[링크]]` → `[링크](링크)`)
|
|
19
|
+
4. **이미지 검증**: 파일 존재, 크기, alt 텍스트 확인
|
|
20
|
+
5. **표 검증**: 열 일관성, 헤더 자동 추가
|
|
21
|
+
6. **구문 검증**: 닫히지 않은 코드 블록 자동 수정
|
|
22
|
+
7. **특수문자 검증**: 이모지 처리, ASCII 다이어그램 경고
|
|
23
|
+
8. **접근성 검증**: WCAG 2.1 AA 표준 준수
|
|
24
|
+
|
|
25
|
+
### 🎨 타이포그래피 프리셋
|
|
26
|
+
|
|
27
|
+
| 프리셋 | 용도 | 특징 |
|
|
28
|
+
|--------|------|------|
|
|
29
|
+
| **소설** | 장편 소설, 에세이 | 16pt, 들여쓰기, 양쪽 정렬 |
|
|
30
|
+
| **발표** | 프레젠테이션, 강의 | 18pt, 큰 글씨, 넓은 여백 |
|
|
31
|
+
| **리뷰** | 검토용 문서 | 11pt, 촘촘한 레이아웃 |
|
|
32
|
+
| **전자책** | 일반 전자책 | 14pt, 균형잡힌 레이아웃 |
|
|
33
|
+
|
|
34
|
+
## 📦 설치
|
|
35
|
+
|
|
36
|
+
### NPX로 바로 사용 (설치 불필요)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx markdown-to-document-cli input.md
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 전역 설치
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g markdown-to-document-cli
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 로컬 설치
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install markdown-to-document-cli
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 🚀 사용법
|
|
55
|
+
|
|
56
|
+
### 기본 사용법
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# EPUB 변환
|
|
60
|
+
npx markdown-to-document-cli document.md
|
|
61
|
+
|
|
62
|
+
# PDF 변환
|
|
63
|
+
npx markdown-to-document-cli document.md --format pdf
|
|
64
|
+
|
|
65
|
+
# EPUB + PDF 동시 변환
|
|
66
|
+
npx markdown-to-document-cli document.md --format both
|
|
67
|
+
|
|
68
|
+
# 전역 설치 후 사용
|
|
69
|
+
m2d document.md
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 옵션
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
m2d document.md [options]
|
|
76
|
+
|
|
77
|
+
옵션:
|
|
78
|
+
-o, --output <path> 출력 디렉토리
|
|
79
|
+
-f, --format <format> 출력 형식 (epub, pdf, both) [기본값: epub]
|
|
80
|
+
-t, --typography <preset> 타이포그래피 프리셋 (novel, presentation, review, ebook) [기본값: ebook]
|
|
81
|
+
-c, --cover <theme> 표지 테마
|
|
82
|
+
--no-validate 콘텐츠 검증 건너뛰기
|
|
83
|
+
--no-auto-fix 자동 수정 비활성화
|
|
84
|
+
--toc-depth <number> 목차 깊이 [기본값: 2]
|
|
85
|
+
--no-toc 목차 비활성화
|
|
86
|
+
--pdf-engine <engine> PDF 엔진 (pdflatex, xelatex, weasyprint) [기본값: weasyprint]
|
|
87
|
+
--paper-size <size> 용지 크기 (a4, letter) [기본값: a4]
|
|
88
|
+
--font-subsetting 폰트 서브세팅 활성화
|
|
89
|
+
--css <path> 커스텀 CSS 파일 경로
|
|
90
|
+
--pandoc-path <path> Pandoc 실행 파일 경로
|
|
91
|
+
-v, --verbose 상세 출력
|
|
92
|
+
-h, --help 도움말 표시
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 예제
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# 소설용 타이포그래피로 EPUB 변환
|
|
99
|
+
m2d novel.md --format epub --typography novel
|
|
100
|
+
|
|
101
|
+
# 발표용 PDF 생성
|
|
102
|
+
m2d presentation.md --format pdf --typography presentation --pdf-engine weasyprint
|
|
103
|
+
|
|
104
|
+
# 출력 디렉토리 지정
|
|
105
|
+
m2d document.md --output ./output
|
|
106
|
+
|
|
107
|
+
# 커스텀 CSS 적용
|
|
108
|
+
m2d document.md --css ./custom.css
|
|
109
|
+
|
|
110
|
+
# 검증 없이 빠르게 변환
|
|
111
|
+
m2d document.md --no-validate --no-auto-fix
|
|
112
|
+
|
|
113
|
+
# 상세 로그 출력
|
|
114
|
+
m2d document.md --verbose
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 인터랙티브 모드
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
m2d interactive
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
가이드에 따라 옵션을 선택할 수 있습니다.
|
|
124
|
+
|
|
125
|
+
### 프리셋 및 테마 목록
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# 타이포그래피 프리셋 목록
|
|
129
|
+
m2d list-presets
|
|
130
|
+
|
|
131
|
+
# 표지 테마 목록
|
|
132
|
+
m2d list-themes
|
|
133
|
+
|
|
134
|
+
# 의존성 확인
|
|
135
|
+
m2d check
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## ⚙️ 필수 요구사항
|
|
139
|
+
|
|
140
|
+
### Pandoc 설치
|
|
141
|
+
|
|
142
|
+
Pandoc 2.19+ 이상이 필요합니다.
|
|
143
|
+
|
|
144
|
+
#### macOS
|
|
145
|
+
```bash
|
|
146
|
+
brew install pandoc
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Windows
|
|
150
|
+
```bash
|
|
151
|
+
winget install --id JohnMacFarlane.Pandoc
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Linux
|
|
155
|
+
```bash
|
|
156
|
+
sudo apt-get install pandoc
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### WeasyPrint (PDF 생성, 선택사항)
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pip install weasyprint
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## 📝 프로그래밍 방식 사용
|
|
166
|
+
|
|
167
|
+
```javascript
|
|
168
|
+
import { MarkdownToDocument } from 'markdown-to-document-cli';
|
|
169
|
+
|
|
170
|
+
const converter = new MarkdownToDocument();
|
|
171
|
+
|
|
172
|
+
// 초기화
|
|
173
|
+
await converter.initialize();
|
|
174
|
+
|
|
175
|
+
// 변환
|
|
176
|
+
const result = await converter.convert({
|
|
177
|
+
inputPath: './document.md',
|
|
178
|
+
outputPath: './output',
|
|
179
|
+
format: 'epub',
|
|
180
|
+
typographyPreset: 'ebook',
|
|
181
|
+
validateContent: true,
|
|
182
|
+
autoFix: true,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
if (result.success) {
|
|
186
|
+
console.log('변환 성공!', result.epubPath);
|
|
187
|
+
} else {
|
|
188
|
+
console.error('변환 실패:', result.errors);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## 🎯 YAML Frontmatter
|
|
193
|
+
|
|
194
|
+
문서 상단에 메타데이터를 추가할 수 있습니다:
|
|
195
|
+
|
|
196
|
+
```yaml
|
|
197
|
+
---
|
|
198
|
+
title: 문서 제목
|
|
199
|
+
subtitle: 부제목
|
|
200
|
+
author: 저자명
|
|
201
|
+
language: ko
|
|
202
|
+
date: 2025-01-05
|
|
203
|
+
description: 문서 설명
|
|
204
|
+
isbn: 978-0-1234-5678-9
|
|
205
|
+
publisher: 출판사명
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
# 문서 내용
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## 🔬 검증 리포트 예시
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
=== 검증 완료 ===
|
|
215
|
+
|
|
216
|
+
✅ 수정됨: 5건
|
|
217
|
+
• Obsidian 링크 3개 변환
|
|
218
|
+
• 코드 블록 1개 자동 닫기
|
|
219
|
+
• 제목 공백 1개 조정
|
|
220
|
+
|
|
221
|
+
⚠️ 경고: 2건
|
|
222
|
+
• 긴 제목 감지 (자동 조정됨)
|
|
223
|
+
• ASCII 다이어그램 (이미지 권장)
|
|
224
|
+
|
|
225
|
+
❌ 오류: 0건
|
|
226
|
+
|
|
227
|
+
총 7개 문제 발견, 5개 자동 수정
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## 📊 기술 스택
|
|
231
|
+
|
|
232
|
+
- **언어**: TypeScript 5.3+
|
|
233
|
+
- **런타임**: Node.js 18+
|
|
234
|
+
- **변환 엔진**: Pandoc 2.19+
|
|
235
|
+
- **CLI 프레임워크**: Commander.js
|
|
236
|
+
- **PDF 엔진**: WeasyPrint (선택사항)
|
|
237
|
+
|
|
238
|
+
## 🐛 문제 해결
|
|
239
|
+
|
|
240
|
+
### Pandoc을 찾을 수 없음
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Pandoc 설치 확인
|
|
244
|
+
pandoc --version
|
|
245
|
+
|
|
246
|
+
# 커스텀 경로 지정
|
|
247
|
+
m2d document.md --pandoc-path /path/to/pandoc
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### PDF 변환 실패
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# WeasyPrint 설치
|
|
254
|
+
pip install weasyprint
|
|
255
|
+
|
|
256
|
+
# 또는 다른 PDF 엔진 사용
|
|
257
|
+
m2d document.md --format pdf --pdf-engine pdflatex
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 이미지를 찾을 수 없음
|
|
261
|
+
|
|
262
|
+
이미지 파일이 마크다운 파일과 동일한 디렉토리 또는 `images/`, `attachments/` 폴더에 있는지 확인하세요.
|
|
263
|
+
|
|
264
|
+
## 📄 라이선스
|
|
265
|
+
|
|
266
|
+
MIT License - [LICENSE](LICENSE) 파일 참조
|
|
267
|
+
|
|
268
|
+
## 🙏 감사의 말
|
|
269
|
+
|
|
270
|
+
- [Obsidian](https://obsidian.md) 팀의 훌륭한 플랫폼
|
|
271
|
+
- [Pandoc](https://pandoc.org) 개발자들
|
|
272
|
+
- 원본 옵시디언 플러그인 [Markdown to Document Pro](https://github.com/bluelion79/obsidian-markdown-to-document)
|
|
273
|
+
|
|
274
|
+
## 📧 문의
|
|
275
|
+
|
|
276
|
+
- GitHub: [@bluelion79](https://github.com/bluelion79)
|
|
277
|
+
- Email: bluelion79@gmail.com
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
**Made with ❤️ by 잘생김프로쌤**
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Markdown to Document CLI
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* npx markdown-to-document-cli <input.md>
|
|
7
|
+
* m2d <input.md> [options]
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from 'commander';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import ora from 'ora';
|
|
12
|
+
import inquirer from 'inquirer';
|
|
13
|
+
import { MarkdownToDocument } from './index.js';
|
|
14
|
+
import { TYPOGRAPHY_PRESETS, COVER_THEMES } from './utils/constants.js';
|
|
15
|
+
import { Logger } from './utils/common.js';
|
|
16
|
+
import * as path from 'path';
|
|
17
|
+
import * as fs from 'fs';
|
|
18
|
+
const program = new Command();
|
|
19
|
+
// Configure CLI
|
|
20
|
+
program
|
|
21
|
+
.name('markdown-to-document')
|
|
22
|
+
.alias('m2d')
|
|
23
|
+
.description('Professional-grade EPUB/PDF conversion tool for Markdown files')
|
|
24
|
+
.version('1.0.0')
|
|
25
|
+
.argument('<input>', 'Input markdown file path')
|
|
26
|
+
.option('-o, --output <path>', 'Output directory')
|
|
27
|
+
.option('-f, --format <format>', 'Output format (epub, pdf, both)', 'epub')
|
|
28
|
+
.option('-t, --typography <preset>', 'Typography preset (novel, presentation, review, ebook)', 'ebook')
|
|
29
|
+
.option('-c, --cover <theme>', 'Cover theme')
|
|
30
|
+
.option('--no-validate', 'Skip content validation')
|
|
31
|
+
.option('--no-auto-fix', 'Disable auto-fix')
|
|
32
|
+
.option('--toc-depth <number>', 'Table of contents depth', '2')
|
|
33
|
+
.option('--no-toc', 'Disable table of contents')
|
|
34
|
+
.option('--pdf-engine <engine>', 'PDF engine (pdflatex, xelatex, weasyprint)', 'weasyprint')
|
|
35
|
+
.option('--paper-size <size>', 'Paper size (a4, letter)', 'a4')
|
|
36
|
+
.option('--font-subsetting', 'Enable font subsetting')
|
|
37
|
+
.option('--css <path>', 'Custom CSS file path')
|
|
38
|
+
.option('--pandoc-path <path>', 'Custom Pandoc executable path')
|
|
39
|
+
.option('-v, --verbose', 'Verbose output')
|
|
40
|
+
.action(async (input, options) => {
|
|
41
|
+
try {
|
|
42
|
+
// Enable verbose logging if requested
|
|
43
|
+
if (options.verbose) {
|
|
44
|
+
Logger.setEnabled(true);
|
|
45
|
+
process.env.DEBUG = 'true';
|
|
46
|
+
}
|
|
47
|
+
// Resolve input path
|
|
48
|
+
const inputPath = path.resolve(input);
|
|
49
|
+
// Check if input file exists
|
|
50
|
+
if (!fs.existsSync(inputPath)) {
|
|
51
|
+
console.error(chalk.red(`❌ Error: Input file not found: ${inputPath}`));
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
// Check if input is markdown
|
|
55
|
+
if (!inputPath.endsWith('.md')) {
|
|
56
|
+
console.error(chalk.yellow('⚠️ Warning: Input file does not have .md extension'));
|
|
57
|
+
}
|
|
58
|
+
console.log(chalk.cyan.bold('\n📚 Markdown to Document CLI\n'));
|
|
59
|
+
// Initialize converter
|
|
60
|
+
const spinner = ora('Initializing...').start();
|
|
61
|
+
const converter = new MarkdownToDocument(options.pandocPath);
|
|
62
|
+
const initResult = await converter.initialize();
|
|
63
|
+
if (!initResult.success) {
|
|
64
|
+
spinner.fail('Initialization failed');
|
|
65
|
+
console.error(chalk.red(`❌ ${initResult.error}`));
|
|
66
|
+
console.log(chalk.yellow('\n' + MarkdownToDocument.getInstallInstructions()));
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
spinner.succeed('Initialized successfully');
|
|
70
|
+
// Prepare conversion options
|
|
71
|
+
const conversionOptions = {
|
|
72
|
+
inputPath,
|
|
73
|
+
outputPath: options.output ? path.resolve(options.output) : undefined,
|
|
74
|
+
format: options.format,
|
|
75
|
+
typographyPreset: options.typography,
|
|
76
|
+
coverTheme: options.cover,
|
|
77
|
+
validateContent: options.validate !== false,
|
|
78
|
+
autoFix: options.autoFix !== false,
|
|
79
|
+
tocDepth: parseInt(options.tocDepth, 10),
|
|
80
|
+
includeToc: options.toc !== false,
|
|
81
|
+
pdfEngine: options.pdfEngine,
|
|
82
|
+
paperSize: options.paperSize,
|
|
83
|
+
enableFontSubsetting: options.fontSubsetting,
|
|
84
|
+
cssPath: options.css ? path.resolve(options.css) : undefined,
|
|
85
|
+
};
|
|
86
|
+
// Show conversion info
|
|
87
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
88
|
+
console.log(chalk.bold('📄 Input:'), chalk.cyan(inputPath));
|
|
89
|
+
console.log(chalk.bold('📤 Format:'), chalk.cyan(conversionOptions.format.toUpperCase()));
|
|
90
|
+
console.log(chalk.bold('🎨 Typography:'), chalk.cyan(TYPOGRAPHY_PRESETS[conversionOptions.typographyPreset]?.name || conversionOptions.typographyPreset));
|
|
91
|
+
if (conversionOptions.coverTheme) {
|
|
92
|
+
console.log(chalk.bold('🖼️ Cover:'), chalk.cyan(COVER_THEMES[conversionOptions.coverTheme]?.name || conversionOptions.coverTheme));
|
|
93
|
+
}
|
|
94
|
+
console.log(chalk.gray('─'.repeat(50)) + '\n');
|
|
95
|
+
// Start conversion
|
|
96
|
+
const convertSpinner = ora('Converting document...').start();
|
|
97
|
+
const result = await converter.convert(conversionOptions);
|
|
98
|
+
if (result.success) {
|
|
99
|
+
convertSpinner.succeed('Conversion completed!');
|
|
100
|
+
// Show validation report if available
|
|
101
|
+
if (result.validationReport) {
|
|
102
|
+
const report = result.validationReport;
|
|
103
|
+
console.log(chalk.gray('\n📊 Validation Report:'));
|
|
104
|
+
if (report.fixedIssues > 0) {
|
|
105
|
+
console.log(chalk.green(` ✅ Fixed: ${report.fixedIssues} issues`));
|
|
106
|
+
}
|
|
107
|
+
if (report.warnings > 0) {
|
|
108
|
+
console.log(chalk.yellow(` ⚠️ Warnings: ${report.warnings}`));
|
|
109
|
+
}
|
|
110
|
+
if (report.errors > 0) {
|
|
111
|
+
console.log(chalk.red(` ❌ Errors: ${report.errors}`));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Show warnings
|
|
115
|
+
if (result.warnings.length > 0) {
|
|
116
|
+
console.log(chalk.yellow('\n⚠️ Warnings:'));
|
|
117
|
+
result.warnings.forEach(warning => {
|
|
118
|
+
console.log(chalk.yellow(` • ${warning}`));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// Show output files
|
|
122
|
+
console.log(chalk.green('\n✅ Output files:'));
|
|
123
|
+
if (result.epubPath) {
|
|
124
|
+
console.log(chalk.green(` 📖 EPUB: ${result.epubPath}`));
|
|
125
|
+
}
|
|
126
|
+
if (result.pdfPath) {
|
|
127
|
+
console.log(chalk.green(` 📄 PDF: ${result.pdfPath}`));
|
|
128
|
+
}
|
|
129
|
+
console.log(chalk.green('\n🎉 Conversion successful!\n'));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
convertSpinner.fail('Conversion failed');
|
|
133
|
+
console.log(chalk.red('\n❌ Errors:'));
|
|
134
|
+
result.errors.forEach(error => {
|
|
135
|
+
console.log(chalk.red(` • ${error}`));
|
|
136
|
+
});
|
|
137
|
+
if (result.warnings.length > 0) {
|
|
138
|
+
console.log(chalk.yellow('\n⚠️ Warnings:'));
|
|
139
|
+
result.warnings.forEach(warning => {
|
|
140
|
+
console.log(chalk.yellow(` • ${warning}`));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
console.log(chalk.red('\n❌ Conversion failed!\n'));
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.error(chalk.red('\n❌ Unexpected error:'));
|
|
149
|
+
console.error(chalk.red(error instanceof Error ? error.message : String(error)));
|
|
150
|
+
if (options.verbose) {
|
|
151
|
+
console.error(chalk.red('\nStack trace:'));
|
|
152
|
+
console.error(error);
|
|
153
|
+
}
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
// Interactive mode
|
|
158
|
+
program
|
|
159
|
+
.command('interactive')
|
|
160
|
+
.alias('i')
|
|
161
|
+
.description('Interactive mode with guided prompts')
|
|
162
|
+
.action(async () => {
|
|
163
|
+
console.log(chalk.cyan.bold('\n📚 Markdown to Document - Interactive Mode\n'));
|
|
164
|
+
const answers = await inquirer.prompt([
|
|
165
|
+
{
|
|
166
|
+
type: 'input',
|
|
167
|
+
name: 'inputPath',
|
|
168
|
+
message: 'Input markdown file path:',
|
|
169
|
+
validate: (input) => {
|
|
170
|
+
const resolvedPath = path.resolve(input);
|
|
171
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
172
|
+
return 'File not found. Please enter a valid path.';
|
|
173
|
+
}
|
|
174
|
+
return true;
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
type: 'list',
|
|
179
|
+
name: 'format',
|
|
180
|
+
message: 'Output format:',
|
|
181
|
+
choices: [
|
|
182
|
+
{ name: 'EPUB only', value: 'epub' },
|
|
183
|
+
{ name: 'PDF only', value: 'pdf' },
|
|
184
|
+
{ name: 'Both EPUB and PDF', value: 'both' },
|
|
185
|
+
],
|
|
186
|
+
default: 'epub',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
type: 'list',
|
|
190
|
+
name: 'typographyPreset',
|
|
191
|
+
message: 'Typography preset:',
|
|
192
|
+
choices: Object.values(TYPOGRAPHY_PRESETS).map(preset => ({
|
|
193
|
+
name: `${preset.name} - ${preset.description}`,
|
|
194
|
+
value: preset.id,
|
|
195
|
+
})),
|
|
196
|
+
default: 'ebook',
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: 'list',
|
|
200
|
+
name: 'coverTheme',
|
|
201
|
+
message: 'Cover theme (optional):',
|
|
202
|
+
choices: [
|
|
203
|
+
{ name: 'None', value: null },
|
|
204
|
+
...Object.values(COVER_THEMES).map(theme => ({
|
|
205
|
+
name: `${theme.name} - ${theme.description}`,
|
|
206
|
+
value: theme.id,
|
|
207
|
+
})),
|
|
208
|
+
],
|
|
209
|
+
default: null,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
type: 'confirm',
|
|
213
|
+
name: 'validateContent',
|
|
214
|
+
message: 'Enable content validation?',
|
|
215
|
+
default: true,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
type: 'confirm',
|
|
219
|
+
name: 'autoFix',
|
|
220
|
+
message: 'Enable auto-fix for detected issues?',
|
|
221
|
+
default: true,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
type: 'input',
|
|
225
|
+
name: 'outputPath',
|
|
226
|
+
message: 'Output directory (leave empty for same as input):',
|
|
227
|
+
default: '',
|
|
228
|
+
},
|
|
229
|
+
]);
|
|
230
|
+
try {
|
|
231
|
+
const spinner = ora('Initializing...').start();
|
|
232
|
+
const converter = new MarkdownToDocument();
|
|
233
|
+
const initResult = await converter.initialize();
|
|
234
|
+
if (!initResult.success) {
|
|
235
|
+
spinner.fail('Initialization failed');
|
|
236
|
+
console.error(chalk.red(`❌ ${initResult.error}`));
|
|
237
|
+
console.log(chalk.yellow('\n' + MarkdownToDocument.getInstallInstructions()));
|
|
238
|
+
process.exit(1);
|
|
239
|
+
}
|
|
240
|
+
spinner.succeed('Initialized successfully');
|
|
241
|
+
const conversionOptions = {
|
|
242
|
+
inputPath: path.resolve(answers.inputPath),
|
|
243
|
+
outputPath: answers.outputPath ? path.resolve(answers.outputPath) : undefined,
|
|
244
|
+
format: answers.format,
|
|
245
|
+
typographyPreset: answers.typographyPreset,
|
|
246
|
+
coverTheme: answers.coverTheme,
|
|
247
|
+
validateContent: answers.validateContent,
|
|
248
|
+
autoFix: answers.autoFix,
|
|
249
|
+
tocDepth: 2,
|
|
250
|
+
includeToc: true,
|
|
251
|
+
};
|
|
252
|
+
const convertSpinner = ora('Converting document...').start();
|
|
253
|
+
const result = await converter.convert(conversionOptions);
|
|
254
|
+
if (result.success) {
|
|
255
|
+
convertSpinner.succeed('Conversion completed!');
|
|
256
|
+
console.log(chalk.green('\n✅ Output files:'));
|
|
257
|
+
if (result.epubPath) {
|
|
258
|
+
console.log(chalk.green(` 📖 EPUB: ${result.epubPath}`));
|
|
259
|
+
}
|
|
260
|
+
if (result.pdfPath) {
|
|
261
|
+
console.log(chalk.green(` 📄 PDF: ${result.pdfPath}`));
|
|
262
|
+
}
|
|
263
|
+
console.log(chalk.green('\n🎉 Conversion successful!\n'));
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
convertSpinner.fail('Conversion failed');
|
|
267
|
+
console.log(chalk.red('\n❌ Errors:'));
|
|
268
|
+
result.errors.forEach(error => {
|
|
269
|
+
console.log(chalk.red(` • ${error}`));
|
|
270
|
+
});
|
|
271
|
+
process.exit(1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
console.error(chalk.red('\n❌ Error:'), error instanceof Error ? error.message : String(error));
|
|
276
|
+
process.exit(1);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
// List presets command
|
|
280
|
+
program
|
|
281
|
+
.command('list-presets')
|
|
282
|
+
.description('List available typography presets')
|
|
283
|
+
.action(() => {
|
|
284
|
+
console.log(chalk.cyan.bold('\n📝 Available Typography Presets:\n'));
|
|
285
|
+
Object.values(TYPOGRAPHY_PRESETS).forEach(preset => {
|
|
286
|
+
console.log(chalk.bold(` ${preset.id}:`), chalk.cyan(preset.name));
|
|
287
|
+
console.log(chalk.gray(` ${preset.description}`));
|
|
288
|
+
console.log(chalk.gray(` Font size: ${preset.fontSize}pt | Line height: ${preset.lineHeight}`));
|
|
289
|
+
console.log();
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
// List themes command
|
|
293
|
+
program
|
|
294
|
+
.command('list-themes')
|
|
295
|
+
.description('List available cover themes')
|
|
296
|
+
.action(() => {
|
|
297
|
+
console.log(chalk.cyan.bold('\n🎨 Available Cover Themes:\n'));
|
|
298
|
+
const categories = {
|
|
299
|
+
basic: 'Basic Themes',
|
|
300
|
+
extended: 'Extended Themes',
|
|
301
|
+
};
|
|
302
|
+
Object.entries(categories).forEach(([category, title]) => {
|
|
303
|
+
console.log(chalk.bold(`\n ${title}:`));
|
|
304
|
+
const themes = Object.values(COVER_THEMES).filter(t => t.category === category);
|
|
305
|
+
themes.forEach(theme => {
|
|
306
|
+
console.log(chalk.gray(` • ${theme.id}: ${theme.description}`));
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
console.log();
|
|
310
|
+
});
|
|
311
|
+
// Check dependencies command
|
|
312
|
+
program
|
|
313
|
+
.command('check')
|
|
314
|
+
.description('Check if required dependencies are installed')
|
|
315
|
+
.action(async () => {
|
|
316
|
+
console.log(chalk.cyan.bold('\n🔍 Checking Dependencies...\n'));
|
|
317
|
+
const converter = new MarkdownToDocument();
|
|
318
|
+
const result = await converter.initialize();
|
|
319
|
+
if (result.success) {
|
|
320
|
+
console.log(chalk.green('✅ All dependencies are installed!\n'));
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
console.log(chalk.red('❌ Dependency check failed\n'));
|
|
324
|
+
console.log(chalk.yellow(result.error || 'Unknown error'));
|
|
325
|
+
console.log(chalk.yellow('\n' + MarkdownToDocument.getInstallInstructions()));
|
|
326
|
+
process.exit(1);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
// Parse arguments
|
|
330
|
+
program.parse(process.argv);
|
|
331
|
+
// Show help if no arguments provided
|
|
332
|
+
if (!process.argv.slice(2).length) {
|
|
333
|
+
program.outputHelp();
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAkB,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,gBAAgB;AAChB,OAAO;KACF,IAAI,CAAC,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