kordoc 2.9.1 → 3.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/README.md +28 -0
- package/dist/-K5SLEFZD.js +71 -0
- package/dist/-K5SLEFZD.js.map +1 -0
- package/dist/{chunk-GQQNAYZA.js → chunk-326STEDU.js} +6684 -4061
- package/dist/chunk-326STEDU.js.map +1 -0
- package/dist/{chunk-FWAXCTSX.cjs → chunk-3WRJQQIO.cjs} +185 -16
- package/dist/chunk-3WRJQQIO.cjs.map +1 -0
- package/dist/chunk-MUOQXDZ4.cjs.map +1 -1
- package/dist/{chunk-Z6TLTWYK.js → chunk-NHXKJWR7.js} +182 -13
- package/dist/chunk-NHXKJWR7.js.map +1 -0
- package/dist/{chunk-ODF24QXC.js → chunk-SA2PERJ5.js} +182 -13
- package/dist/chunk-SA2PERJ5.js.map +1 -0
- package/dist/cli.js +42 -3
- package/dist/cli.js.map +1 -1
- package/dist/formula-XGG6ZP42.cjs.map +1 -1
- package/dist/index.cjs +3247 -822
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -2
- package/dist/index.d.ts +61 -2
- package/dist/index.js +3025 -600
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +3 -3
- package/dist/page-range-3C7UGGEK.cjs.map +1 -1
- package/dist/{parser-BKYM3LKN.js → parser-4IVYHKSL.js} +677 -85
- package/dist/parser-4IVYHKSL.js.map +1 -0
- package/dist/{parser-BTIPAEDZ.cjs → parser-5KHU732L.cjs} +689 -97
- package/dist/parser-5KHU732L.cjs.map +1 -0
- package/dist/{parser-FJNQEW7K.js → parser-AU2NLC44.js} +677 -85
- package/dist/parser-AU2NLC44.js.map +1 -0
- package/dist/provider-SNONEZNW.cjs.map +1 -1
- package/dist/{watch-SBLSWHL7.js → watch-5DDN4BUI.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-FWAXCTSX.cjs.map +0 -1
- package/dist/chunk-GQQNAYZA.js.map +0 -1
- package/dist/chunk-ODF24QXC.js.map +0 -1
- package/dist/chunk-Z6TLTWYK.js.map +0 -1
- package/dist/parser-BKYM3LKN.js.map +0 -1
- package/dist/parser-BTIPAEDZ.cjs.map +0 -1
- package/dist/parser-FJNQEW7K.js.map +0 -1
- /package/dist/{watch-SBLSWHL7.js.map → watch-5DDN4BUI.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -63,11 +63,21 @@ interface IRTable {
|
|
|
63
63
|
cells: IRCell[][];
|
|
64
64
|
/** 첫 행을 헤더로 렌더링할지 여부 (현재: rows > 1이면 true — 의미적 감지가 아닌 레이아웃 힌트) */
|
|
65
65
|
hasHeader: boolean;
|
|
66
|
+
/** 표 캡션 (예: "표 1. 부서별 예산") — v3.0 */
|
|
67
|
+
caption?: string;
|
|
66
68
|
}
|
|
67
69
|
interface IRCell {
|
|
68
70
|
text: string;
|
|
69
71
|
colSpan: number;
|
|
70
72
|
rowSpan: number;
|
|
73
|
+
/**
|
|
74
|
+
* 셀 내부 블록 콘텐츠 — v3.0.
|
|
75
|
+
* 중첩 표·이미지·다중 문단을 구조 그대로 보존한다.
|
|
76
|
+
* blocks가 있으면 text는 blocks의 평탄화 텍스트(하위 호환용)다.
|
|
77
|
+
*/
|
|
78
|
+
blocks?: IRBlock[];
|
|
79
|
+
/** 제목 셀 여부 (HWP5 width_ref bit2 / HWPX header 속성) — v3.0 */
|
|
80
|
+
isHeader?: boolean;
|
|
71
81
|
}
|
|
72
82
|
/** 문서 메타데이터 — 각 포맷에서 추출 가능한 필드만 채워짐 */
|
|
73
83
|
interface DocumentMetadata {
|
|
@@ -133,7 +143,7 @@ interface ParseWarning {
|
|
|
133
143
|
/** 구조화된 경고 코드 */
|
|
134
144
|
code: WarningCode;
|
|
135
145
|
}
|
|
136
|
-
type WarningCode = "SKIPPED_IMAGE" | "SKIPPED_OLE" | "TRUNCATED_TABLE" | "OCR_FALLBACK" | "UNSUPPORTED_ELEMENT" | "BROKEN_ZIP_RECOVERY" | "HIDDEN_TEXT_FILTERED" | "MALFORMED_XML" | "PARTIAL_PARSE" | "LENIENT_CFB_RECOVERY";
|
|
146
|
+
type WarningCode = "SKIPPED_IMAGE" | "SKIPPED_OLE" | "TRUNCATED_TABLE" | "OCR_FALLBACK" | "UNSUPPORTED_ELEMENT" | "BROKEN_ZIP_RECOVERY" | "HIDDEN_TEXT_FILTERED" | "MALFORMED_XML" | "PARTIAL_PARSE" | "LENIENT_CFB_RECOVERY" | "NEEDS_OCR";
|
|
137
147
|
/** 문서 구조 (헤딩 트리) */
|
|
138
148
|
interface OutlineItem {
|
|
139
149
|
level: number;
|
|
@@ -236,6 +246,34 @@ interface DiffResult {
|
|
|
236
246
|
};
|
|
237
247
|
diffs: BlockDiff[];
|
|
238
248
|
}
|
|
249
|
+
/** 패치 중 매핑 실패/미지원으로 건너뛴 항목 — silent 실패 금지 */
|
|
250
|
+
interface PatchSkip {
|
|
251
|
+
/** 건너뛴 사유 */
|
|
252
|
+
reason: string;
|
|
253
|
+
/** 원본 쪽 내용 요약 (최대 80자) */
|
|
254
|
+
before?: string;
|
|
255
|
+
/** 편집 쪽 내용 요약 (최대 80자) */
|
|
256
|
+
after?: string;
|
|
257
|
+
}
|
|
258
|
+
/** patchHwpx 옵션 */
|
|
259
|
+
interface PatchOptions {
|
|
260
|
+
/** 패치 후 재파싱 자동 검증 (기본 true) */
|
|
261
|
+
verify?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/** patchHwpx 결과 */
|
|
264
|
+
interface PatchResult {
|
|
265
|
+
success: boolean;
|
|
266
|
+
/** 패치된 HWPX (success=true) */
|
|
267
|
+
data?: Uint8Array;
|
|
268
|
+
/** 적용된 변경 수 */
|
|
269
|
+
applied: number;
|
|
270
|
+
/** 매핑 실패 항목 (이유 포함) */
|
|
271
|
+
skipped: PatchSkip[];
|
|
272
|
+
/** 자동 검증: 패치본 재파싱 vs 편집 마크다운 diff */
|
|
273
|
+
verification?: DiffResult;
|
|
274
|
+
/** 실패 사유 (success=false) */
|
|
275
|
+
error?: string;
|
|
276
|
+
}
|
|
239
277
|
interface FormField {
|
|
240
278
|
label: string;
|
|
241
279
|
value: string;
|
|
@@ -374,6 +412,27 @@ interface MarkdownToHwpxOptions {
|
|
|
374
412
|
*/
|
|
375
413
|
declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOptions): Promise<ArrayBuffer>;
|
|
376
414
|
|
|
415
|
+
/**
|
|
416
|
+
* HWPX 서식 보존 무손실 라운드트립 패치 — v3.0 킬러기능.
|
|
417
|
+
*
|
|
418
|
+
* parse()로 얻은 마크다운을 편집한 뒤 patchHwpx()에 넘기면, 원본 HWPX의
|
|
419
|
+
* ZIP/XML 구조를 그대로 두고 변경된 문단/셀의 텍스트만 in-place 치환한다.
|
|
420
|
+
* 스타일·이미지·표 구조·설정은 1바이트도 건드리지 않는다 (section XML 외
|
|
421
|
+
* ZIP 엔트리는 원본 바이트 그대로, 변경 문단도 run 구조·charPr 보존).
|
|
422
|
+
*
|
|
423
|
+
* 지원: 문단/헤딩 텍스트 수정, 표 셀 텍스트 수정 (GFM·HTML·1x1·1열 표).
|
|
424
|
+
* 미지원(graceful skip): 블록 추가/삭제/순서 변경, 표 구조 변경, 캡션·각주·
|
|
425
|
+
* 머리말/꼬리말·이미지 변경. skipped[]에 사유와 함께 보고된다.
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* 원본 HWPX와 편집된 마크다운으로 서식 보존 패치본을 만든다.
|
|
430
|
+
*
|
|
431
|
+
* @param original 원본 HWPX 바이트
|
|
432
|
+
* @param editedMarkdown parse(original).markdown을 편집한 마크다운
|
|
433
|
+
*/
|
|
434
|
+
declare function patchHwpx(original: Uint8Array, editedMarkdown: string, options?: PatchOptions): Promise<PatchResult>;
|
|
435
|
+
|
|
377
436
|
/**
|
|
378
437
|
* Print Renderer — Markdown / IRBlock[] → PDF (puppeteer-core 기반).
|
|
379
438
|
*
|
|
@@ -519,4 +578,4 @@ interface FillFormOutput {
|
|
|
519
578
|
*/
|
|
520
579
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, string>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
521
580
|
|
|
522
|
-
export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormResult, type HwpxFillResult, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PrintOptions, type PrintPreset, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, blocksToPdf, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, fillForm, fillFormFields, fillHwpx, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, renderHtml };
|
|
581
|
+
export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormResult, type HwpxFillResult, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, blocksToPdf, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, fillForm, fillFormFields, fillHwpx, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwpx, renderHtml };
|
package/dist/index.d.ts
CHANGED
|
@@ -63,11 +63,21 @@ interface IRTable {
|
|
|
63
63
|
cells: IRCell[][];
|
|
64
64
|
/** 첫 행을 헤더로 렌더링할지 여부 (현재: rows > 1이면 true — 의미적 감지가 아닌 레이아웃 힌트) */
|
|
65
65
|
hasHeader: boolean;
|
|
66
|
+
/** 표 캡션 (예: "표 1. 부서별 예산") — v3.0 */
|
|
67
|
+
caption?: string;
|
|
66
68
|
}
|
|
67
69
|
interface IRCell {
|
|
68
70
|
text: string;
|
|
69
71
|
colSpan: number;
|
|
70
72
|
rowSpan: number;
|
|
73
|
+
/**
|
|
74
|
+
* 셀 내부 블록 콘텐츠 — v3.0.
|
|
75
|
+
* 중첩 표·이미지·다중 문단을 구조 그대로 보존한다.
|
|
76
|
+
* blocks가 있으면 text는 blocks의 평탄화 텍스트(하위 호환용)다.
|
|
77
|
+
*/
|
|
78
|
+
blocks?: IRBlock[];
|
|
79
|
+
/** 제목 셀 여부 (HWP5 width_ref bit2 / HWPX header 속성) — v3.0 */
|
|
80
|
+
isHeader?: boolean;
|
|
71
81
|
}
|
|
72
82
|
/** 문서 메타데이터 — 각 포맷에서 추출 가능한 필드만 채워짐 */
|
|
73
83
|
interface DocumentMetadata {
|
|
@@ -133,7 +143,7 @@ interface ParseWarning {
|
|
|
133
143
|
/** 구조화된 경고 코드 */
|
|
134
144
|
code: WarningCode;
|
|
135
145
|
}
|
|
136
|
-
type WarningCode = "SKIPPED_IMAGE" | "SKIPPED_OLE" | "TRUNCATED_TABLE" | "OCR_FALLBACK" | "UNSUPPORTED_ELEMENT" | "BROKEN_ZIP_RECOVERY" | "HIDDEN_TEXT_FILTERED" | "MALFORMED_XML" | "PARTIAL_PARSE" | "LENIENT_CFB_RECOVERY";
|
|
146
|
+
type WarningCode = "SKIPPED_IMAGE" | "SKIPPED_OLE" | "TRUNCATED_TABLE" | "OCR_FALLBACK" | "UNSUPPORTED_ELEMENT" | "BROKEN_ZIP_RECOVERY" | "HIDDEN_TEXT_FILTERED" | "MALFORMED_XML" | "PARTIAL_PARSE" | "LENIENT_CFB_RECOVERY" | "NEEDS_OCR";
|
|
137
147
|
/** 문서 구조 (헤딩 트리) */
|
|
138
148
|
interface OutlineItem {
|
|
139
149
|
level: number;
|
|
@@ -236,6 +246,34 @@ interface DiffResult {
|
|
|
236
246
|
};
|
|
237
247
|
diffs: BlockDiff[];
|
|
238
248
|
}
|
|
249
|
+
/** 패치 중 매핑 실패/미지원으로 건너뛴 항목 — silent 실패 금지 */
|
|
250
|
+
interface PatchSkip {
|
|
251
|
+
/** 건너뛴 사유 */
|
|
252
|
+
reason: string;
|
|
253
|
+
/** 원본 쪽 내용 요약 (최대 80자) */
|
|
254
|
+
before?: string;
|
|
255
|
+
/** 편집 쪽 내용 요약 (최대 80자) */
|
|
256
|
+
after?: string;
|
|
257
|
+
}
|
|
258
|
+
/** patchHwpx 옵션 */
|
|
259
|
+
interface PatchOptions {
|
|
260
|
+
/** 패치 후 재파싱 자동 검증 (기본 true) */
|
|
261
|
+
verify?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/** patchHwpx 결과 */
|
|
264
|
+
interface PatchResult {
|
|
265
|
+
success: boolean;
|
|
266
|
+
/** 패치된 HWPX (success=true) */
|
|
267
|
+
data?: Uint8Array;
|
|
268
|
+
/** 적용된 변경 수 */
|
|
269
|
+
applied: number;
|
|
270
|
+
/** 매핑 실패 항목 (이유 포함) */
|
|
271
|
+
skipped: PatchSkip[];
|
|
272
|
+
/** 자동 검증: 패치본 재파싱 vs 편집 마크다운 diff */
|
|
273
|
+
verification?: DiffResult;
|
|
274
|
+
/** 실패 사유 (success=false) */
|
|
275
|
+
error?: string;
|
|
276
|
+
}
|
|
239
277
|
interface FormField {
|
|
240
278
|
label: string;
|
|
241
279
|
value: string;
|
|
@@ -374,6 +412,27 @@ interface MarkdownToHwpxOptions {
|
|
|
374
412
|
*/
|
|
375
413
|
declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOptions): Promise<ArrayBuffer>;
|
|
376
414
|
|
|
415
|
+
/**
|
|
416
|
+
* HWPX 서식 보존 무손실 라운드트립 패치 — v3.0 킬러기능.
|
|
417
|
+
*
|
|
418
|
+
* parse()로 얻은 마크다운을 편집한 뒤 patchHwpx()에 넘기면, 원본 HWPX의
|
|
419
|
+
* ZIP/XML 구조를 그대로 두고 변경된 문단/셀의 텍스트만 in-place 치환한다.
|
|
420
|
+
* 스타일·이미지·표 구조·설정은 1바이트도 건드리지 않는다 (section XML 외
|
|
421
|
+
* ZIP 엔트리는 원본 바이트 그대로, 변경 문단도 run 구조·charPr 보존).
|
|
422
|
+
*
|
|
423
|
+
* 지원: 문단/헤딩 텍스트 수정, 표 셀 텍스트 수정 (GFM·HTML·1x1·1열 표).
|
|
424
|
+
* 미지원(graceful skip): 블록 추가/삭제/순서 변경, 표 구조 변경, 캡션·각주·
|
|
425
|
+
* 머리말/꼬리말·이미지 변경. skipped[]에 사유와 함께 보고된다.
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* 원본 HWPX와 편집된 마크다운으로 서식 보존 패치본을 만든다.
|
|
430
|
+
*
|
|
431
|
+
* @param original 원본 HWPX 바이트
|
|
432
|
+
* @param editedMarkdown parse(original).markdown을 편집한 마크다운
|
|
433
|
+
*/
|
|
434
|
+
declare function patchHwpx(original: Uint8Array, editedMarkdown: string, options?: PatchOptions): Promise<PatchResult>;
|
|
435
|
+
|
|
377
436
|
/**
|
|
378
437
|
* Print Renderer — Markdown / IRBlock[] → PDF (puppeteer-core 기반).
|
|
379
438
|
*
|
|
@@ -519,4 +578,4 @@ interface FillFormOutput {
|
|
|
519
578
|
*/
|
|
520
579
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, string>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
521
580
|
|
|
522
|
-
export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormResult, type HwpxFillResult, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PrintOptions, type PrintPreset, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, blocksToPdf, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, fillForm, fillFormFields, fillHwpx, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, renderHtml };
|
|
581
|
+
export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormResult, type HwpxFillResult, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, blocksToPdf, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, fillForm, fillFormFields, fillHwpx, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwpx, renderHtml };
|