kordoc 1.7.2 → 1.9.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/dist/index.d.cts CHANGED
@@ -61,6 +61,7 @@ interface IRTable {
61
61
  rows: number;
62
62
  cols: number;
63
63
  cells: IRCell[][];
64
+ /** 첫 행을 헤더로 렌더링할지 여부 (현재: rows > 1이면 true — 의미적 감지가 아닌 레이아웃 힌트) */
64
65
  hasHeader: boolean;
65
66
  }
66
67
  interface IRCell {
@@ -124,10 +125,10 @@ interface OutlineItem {
124
125
  }
125
126
  /** 구조화된 에러 코드 — 프로그래밍적 에러 핸들링용 */
126
127
  type ErrorCode = "EMPTY_INPUT" | "UNSUPPORTED_FORMAT" | "ENCRYPTED" | "DRM_PROTECTED" | "CORRUPTED" | "DECOMPRESSION_BOMB" | "ZIP_BOMB" | "IMAGE_BASED_PDF" | "NO_SECTIONS" | "PARSE_ERROR";
127
- type FileType = "hwpx" | "hwp" | "pdf" | "unknown";
128
+ type FileType = "hwpx" | "hwp" | "pdf" | "xlsx" | "docx" | "unknown";
128
129
  interface ParseResultBase {
129
130
  fileType: FileType;
130
- /** PDF 페이지 수 */
131
+ /** 페이지/섹션 수 — PDF: 실제 페이지 수, HWP/HWPX: 섹션 수, XLSX: 시트 수 */
131
132
  pageCount?: number;
132
133
  /** 이미지 기반 PDF 여부 (텍스트 추출 불가) */
133
134
  isImageBased?: boolean;
@@ -252,14 +253,21 @@ declare function markdownToHwpx(markdown: string): Promise<ArrayBuffer>;
252
253
 
253
254
  /** 매직 바이트 기반 파일 포맷 감지 */
254
255
 
255
- /** HWPX (ZIP 기반 한컴 문서): PK\x03\x04 */
256
+ /** ZIP 파일 여부: PK\x03\x04 */
257
+ declare function isZipFile(buffer: ArrayBuffer): boolean;
258
+ /** HWPX (ZIP 기반 한컴 문서): PK\x03\x04 — 하위 호환용 */
256
259
  declare function isHwpxFile(buffer: ArrayBuffer): boolean;
257
260
  /** HWP 5.x (OLE2 바이너리 한컴 문서): \xD0\xCF\x11\xE0 */
258
261
  declare function isOldHwpFile(buffer: ArrayBuffer): boolean;
259
262
  /** PDF 문서: %PDF */
260
263
  declare function isPdfFile(buffer: ArrayBuffer): boolean;
261
- /** 버퍼로부터 파일 포맷 감지 */
264
+ /** 동기 포맷 감지 — ZIP은 모두 "hwpx"로 반환 (하위 호환) */
262
265
  declare function detectFormat(buffer: ArrayBuffer): FileType;
266
+ /**
267
+ * ZIP 내부 구조 기반 포맷 세분화.
268
+ * HWPX, XLSX, DOCX 모두 ZIP이므로 내부 파일로 구분.
269
+ */
270
+ declare function detectZipFormat(buffer: ArrayBuffer): Promise<"hwpx" | "xlsx" | "docx" | "unknown">;
263
271
 
264
272
  /** 2-pass colSpan/rowSpan 테이블 빌더 및 Markdown 변환 */
265
273
 
@@ -293,5 +301,9 @@ declare function parseHwpx(buffer: ArrayBuffer, options?: ParseOptions): Promise
293
301
  declare function parseHwp(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
294
302
  /** PDF 파일에서 텍스트를 추출하여 Markdown으로 변환 */
295
303
  declare function parsePdf(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
304
+ /** XLSX 파일을 Markdown으로 변환 */
305
+ declare function parseXlsx(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
306
+ /** DOCX 파일을 Markdown으로 변환 */
307
+ declare function parseDocx(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
296
308
 
297
- export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type ErrorCode, type ExtractedImage, type FileType, type FormField, type FormResult, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type OcrProvider, type OutlineItem, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, compare, detectFormat, diffBlocks, extractFormFields, isHwpxFile, isOldHwpFile, isPdfFile, markdownToHwpx, parse, parseHwp, parseHwpx, parsePdf };
309
+ export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type ErrorCode, type ExtractedImage, type FileType, type FormField, type FormResult, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type OcrProvider, type OutlineItem, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, compare, detectFormat, detectZipFormat, diffBlocks, extractFormFields, isHwpxFile, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, parse, parseDocx, parseHwp, parseHwpx, parsePdf, parseXlsx };
package/dist/index.d.ts CHANGED
@@ -61,6 +61,7 @@ interface IRTable {
61
61
  rows: number;
62
62
  cols: number;
63
63
  cells: IRCell[][];
64
+ /** 첫 행을 헤더로 렌더링할지 여부 (현재: rows > 1이면 true — 의미적 감지가 아닌 레이아웃 힌트) */
64
65
  hasHeader: boolean;
65
66
  }
66
67
  interface IRCell {
@@ -124,10 +125,10 @@ interface OutlineItem {
124
125
  }
125
126
  /** 구조화된 에러 코드 — 프로그래밍적 에러 핸들링용 */
126
127
  type ErrorCode = "EMPTY_INPUT" | "UNSUPPORTED_FORMAT" | "ENCRYPTED" | "DRM_PROTECTED" | "CORRUPTED" | "DECOMPRESSION_BOMB" | "ZIP_BOMB" | "IMAGE_BASED_PDF" | "NO_SECTIONS" | "PARSE_ERROR";
127
- type FileType = "hwpx" | "hwp" | "pdf" | "unknown";
128
+ type FileType = "hwpx" | "hwp" | "pdf" | "xlsx" | "docx" | "unknown";
128
129
  interface ParseResultBase {
129
130
  fileType: FileType;
130
- /** PDF 페이지 수 */
131
+ /** 페이지/섹션 수 — PDF: 실제 페이지 수, HWP/HWPX: 섹션 수, XLSX: 시트 수 */
131
132
  pageCount?: number;
132
133
  /** 이미지 기반 PDF 여부 (텍스트 추출 불가) */
133
134
  isImageBased?: boolean;
@@ -252,14 +253,21 @@ declare function markdownToHwpx(markdown: string): Promise<ArrayBuffer>;
252
253
 
253
254
  /** 매직 바이트 기반 파일 포맷 감지 */
254
255
 
255
- /** HWPX (ZIP 기반 한컴 문서): PK\x03\x04 */
256
+ /** ZIP 파일 여부: PK\x03\x04 */
257
+ declare function isZipFile(buffer: ArrayBuffer): boolean;
258
+ /** HWPX (ZIP 기반 한컴 문서): PK\x03\x04 — 하위 호환용 */
256
259
  declare function isHwpxFile(buffer: ArrayBuffer): boolean;
257
260
  /** HWP 5.x (OLE2 바이너리 한컴 문서): \xD0\xCF\x11\xE0 */
258
261
  declare function isOldHwpFile(buffer: ArrayBuffer): boolean;
259
262
  /** PDF 문서: %PDF */
260
263
  declare function isPdfFile(buffer: ArrayBuffer): boolean;
261
- /** 버퍼로부터 파일 포맷 감지 */
264
+ /** 동기 포맷 감지 — ZIP은 모두 "hwpx"로 반환 (하위 호환) */
262
265
  declare function detectFormat(buffer: ArrayBuffer): FileType;
266
+ /**
267
+ * ZIP 내부 구조 기반 포맷 세분화.
268
+ * HWPX, XLSX, DOCX 모두 ZIP이므로 내부 파일로 구분.
269
+ */
270
+ declare function detectZipFormat(buffer: ArrayBuffer): Promise<"hwpx" | "xlsx" | "docx" | "unknown">;
263
271
 
264
272
  /** 2-pass colSpan/rowSpan 테이블 빌더 및 Markdown 변환 */
265
273
 
@@ -293,5 +301,9 @@ declare function parseHwpx(buffer: ArrayBuffer, options?: ParseOptions): Promise
293
301
  declare function parseHwp(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
294
302
  /** PDF 파일에서 텍스트를 추출하여 Markdown으로 변환 */
295
303
  declare function parsePdf(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
304
+ /** XLSX 파일을 Markdown으로 변환 */
305
+ declare function parseXlsx(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
306
+ /** DOCX 파일을 Markdown으로 변환 */
307
+ declare function parseDocx(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
296
308
 
297
- export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type ErrorCode, type ExtractedImage, type FileType, type FormField, type FormResult, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type OcrProvider, type OutlineItem, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, compare, detectFormat, diffBlocks, extractFormFields, isHwpxFile, isOldHwpFile, isPdfFile, markdownToHwpx, parse, parseHwp, parseHwpx, parsePdf };
309
+ export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type ErrorCode, type ExtractedImage, type FileType, type FormField, type FormResult, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type OcrProvider, type OutlineItem, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, compare, detectFormat, detectZipFormat, diffBlocks, extractFormFields, isHwpxFile, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, parse, parseDocx, parseHwp, parseHwpx, parsePdf, parseXlsx };