kordoc 3.8.4 → 3.10.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.
Files changed (38) hide show
  1. package/README.md +39 -0
  2. package/dist/{-ZAIG6FWT.js → -3B5FDXW2.js} +18 -12
  3. package/dist/{chunk-2UDAEQPW.js → chunk-5DL6VCIJ.js} +4 -120
  4. package/dist/chunk-5DL6VCIJ.js.map +1 -0
  5. package/dist/{chunk-6EDNKPXQ.js → chunk-5TK4X4JQ.js} +373 -315
  6. package/dist/chunk-5TK4X4JQ.js.map +1 -0
  7. package/dist/chunk-FU25KFFZ.js +938 -0
  8. package/dist/chunk-FU25KFFZ.js.map +1 -0
  9. package/dist/chunk-MZA7AXHN.js +124 -0
  10. package/dist/chunk-MZA7AXHN.js.map +1 -0
  11. package/dist/{chunk-T4SGNVVS.js → chunk-PNXOUDS7.js} +2 -2
  12. package/dist/{chunk-T4SGNVVS.js.map → chunk-PNXOUDS7.js.map} +1 -1
  13. package/dist/{chunk-Z3O36LBJ.cjs → chunk-ZQOGTAT5.cjs} +2 -2
  14. package/dist/{chunk-Z3O36LBJ.cjs.map → chunk-ZQOGTAT5.cjs.map} +1 -1
  15. package/dist/cli.js +33 -6
  16. package/dist/cli.js.map +1 -1
  17. package/dist/index.cjs +1136 -173
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +40 -1
  20. package/dist/index.d.ts +40 -1
  21. package/dist/index.js +1018 -55
  22. package/dist/index.js.map +1 -1
  23. package/dist/mcp.js +8 -5
  24. package/dist/mcp.js.map +1 -1
  25. package/dist/{parser-ZVKCFXR3.cjs → parser-6B7BUSX3.cjs} +14 -14
  26. package/dist/{parser-ZVKCFXR3.cjs.map → parser-6B7BUSX3.cjs.map} +1 -1
  27. package/dist/{parser-2THIF623.js → parser-DKIA66MN.js} +2 -2
  28. package/dist/{parser-PR7CPMM4.js → parser-VCJTQVAH.js} +8 -6
  29. package/dist/{parser-PR7CPMM4.js.map → parser-VCJTQVAH.js.map} +1 -1
  30. package/dist/render-4I72JOAR.js +9 -0
  31. package/dist/render-4I72JOAR.js.map +1 -0
  32. package/dist/{watch-2HYPNMOB.js → watch-MQTMNUSB.js} +6 -4
  33. package/dist/{watch-2HYPNMOB.js.map → watch-MQTMNUSB.js.map} +1 -1
  34. package/package.json +2 -2
  35. package/dist/chunk-2UDAEQPW.js.map +0 -1
  36. package/dist/chunk-6EDNKPXQ.js.map +0 -1
  37. /package/dist/{-ZAIG6FWT.js.map → -3B5FDXW2.js.map} +0 -0
  38. /package/dist/{parser-2THIF623.js.map → parser-DKIA66MN.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -940,6 +940,45 @@ declare function markdownToPdf(markdown: string, options?: PrintOptions): Promis
940
940
  /** IRBlock[] → PDF (Buffer). */
941
941
  declare function blocksToPdf(blocks: IRBlock[], options?: PrintOptions): Promise<Buffer>;
942
942
 
943
+ /**
944
+ * 레이아웃 보존 렌더 — HWPX 조판 캐시(lineseg·cellAddr·hp:pos)를 SVG 절대배치로 그린다.
945
+ *
946
+ * 조판 엔진 없음: 한컴이 저장 시 기록한 좌표를 그대로 사용한다. 따라서
947
+ * 한컴(또는 조판 캐시를 기록하는 편집기)에서 저장한 파일만 렌더 가능 —
948
+ * markdownToHwpx 산출물엔 linesegarray가 없어 KordocError를 던진다.
949
+ *
950
+ * 좌표 산식(실측 검증 — .claude/plans/render-poc/findings.md):
951
+ * - 단위 HWPUNIT(1/7200in), pt = /100. 최상위 문단 lineseg = 본문영역 로컬,
952
+ * 셀 문단 = 셀 로컬. PARA 밀어내기 개체 anchor = 호스트vp − (omTop+h+omBottom) 역산.
953
+ * - horzsize는 줄 "영역" 폭(텍스트 폭 아님) — 마지막 줄이 아닌 줄은 원본 줄바꿈에
954
+ * 맞춰 textLength로 고정하고, 마지막 줄만 paraPr 정렬(LEFT 자연폭/CENTER/RIGHT/배분)을 적용.
955
+ * - 좌표 속성엔 uint32로 저장된 음수가 섞여 있다(toInt32 필수).
956
+ * - 표 열은 span 제약 경계 전파로, 행은 rs=1 max + 콘텐츠 초과 성장으로 푼다.
957
+ *
958
+ * 범위: 1페이지(section0) 한정, 수식·그리기개체 도형은 미지원(경고 수집).
959
+ */
960
+ interface RenderSvgOptions {
961
+ /** 이미지 1장당 허용 최대 바이트 (기본 40MB) */
962
+ maxImageBytes?: number;
963
+ }
964
+ interface RenderSvgResult {
965
+ svg: string;
966
+ /** 페이지 크기 (pt) */
967
+ width: number;
968
+ height: number;
969
+ warnings: string[];
970
+ stats: {
971
+ texts: number;
972
+ images: number;
973
+ tables: number;
974
+ };
975
+ }
976
+ /**
977
+ * HWPX(한컴 저장본) → 레이아웃 보존 SVG (1페이지).
978
+ * 조판 캐시(linesegarray)가 없는 파일(예: markdownToHwpx 산출물)은 KordocError.
979
+ */
980
+ declare function renderHwpxToSvg(input: ArrayBuffer | Uint8Array, options?: RenderSvgOptions): Promise<RenderSvgResult>;
981
+
943
982
  /** 매직 바이트 기반 파일 포맷 감지 */
944
983
 
945
984
  /** ZIP 파일 여부: PK\x03\x04 */
@@ -1040,4 +1079,4 @@ interface FillFormOutput {
1040
1079
  */
1041
1080
  declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillValue>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
1042
1081
 
1043
- export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BoundingBox, type CellCapability, 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 FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type GongmunFont, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type GongmunPresetInput, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type MeasureOptions, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SectionScan, type SpliceEdit, type TRange, VERSION, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fitRatioForFewerLines, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, renderHtml, scanSectionXml, simulateWrap, simulateWrapKeepWord };
1082
+ export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BoundingBox, type CellCapability, 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 FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type GongmunFont, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type GongmunPresetInput, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type MeasureOptions, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SectionScan, type SpliceEdit, type TRange, VERSION, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fitRatioForFewerLines, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord };
package/dist/index.d.ts CHANGED
@@ -940,6 +940,45 @@ declare function markdownToPdf(markdown: string, options?: PrintOptions): Promis
940
940
  /** IRBlock[] → PDF (Buffer). */
941
941
  declare function blocksToPdf(blocks: IRBlock[], options?: PrintOptions): Promise<Buffer>;
942
942
 
943
+ /**
944
+ * 레이아웃 보존 렌더 — HWPX 조판 캐시(lineseg·cellAddr·hp:pos)를 SVG 절대배치로 그린다.
945
+ *
946
+ * 조판 엔진 없음: 한컴이 저장 시 기록한 좌표를 그대로 사용한다. 따라서
947
+ * 한컴(또는 조판 캐시를 기록하는 편집기)에서 저장한 파일만 렌더 가능 —
948
+ * markdownToHwpx 산출물엔 linesegarray가 없어 KordocError를 던진다.
949
+ *
950
+ * 좌표 산식(실측 검증 — .claude/plans/render-poc/findings.md):
951
+ * - 단위 HWPUNIT(1/7200in), pt = /100. 최상위 문단 lineseg = 본문영역 로컬,
952
+ * 셀 문단 = 셀 로컬. PARA 밀어내기 개체 anchor = 호스트vp − (omTop+h+omBottom) 역산.
953
+ * - horzsize는 줄 "영역" 폭(텍스트 폭 아님) — 마지막 줄이 아닌 줄은 원본 줄바꿈에
954
+ * 맞춰 textLength로 고정하고, 마지막 줄만 paraPr 정렬(LEFT 자연폭/CENTER/RIGHT/배분)을 적용.
955
+ * - 좌표 속성엔 uint32로 저장된 음수가 섞여 있다(toInt32 필수).
956
+ * - 표 열은 span 제약 경계 전파로, 행은 rs=1 max + 콘텐츠 초과 성장으로 푼다.
957
+ *
958
+ * 범위: 1페이지(section0) 한정, 수식·그리기개체 도형은 미지원(경고 수집).
959
+ */
960
+ interface RenderSvgOptions {
961
+ /** 이미지 1장당 허용 최대 바이트 (기본 40MB) */
962
+ maxImageBytes?: number;
963
+ }
964
+ interface RenderSvgResult {
965
+ svg: string;
966
+ /** 페이지 크기 (pt) */
967
+ width: number;
968
+ height: number;
969
+ warnings: string[];
970
+ stats: {
971
+ texts: number;
972
+ images: number;
973
+ tables: number;
974
+ };
975
+ }
976
+ /**
977
+ * HWPX(한컴 저장본) → 레이아웃 보존 SVG (1페이지).
978
+ * 조판 캐시(linesegarray)가 없는 파일(예: markdownToHwpx 산출물)은 KordocError.
979
+ */
980
+ declare function renderHwpxToSvg(input: ArrayBuffer | Uint8Array, options?: RenderSvgOptions): Promise<RenderSvgResult>;
981
+
943
982
  /** 매직 바이트 기반 파일 포맷 감지 */
944
983
 
945
984
  /** ZIP 파일 여부: PK\x03\x04 */
@@ -1040,4 +1079,4 @@ interface FillFormOutput {
1040
1079
  */
1041
1080
  declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillValue>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
1042
1081
 
1043
- export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BoundingBox, type CellCapability, 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 FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type GongmunFont, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type GongmunPresetInput, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type MeasureOptions, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SectionScan, type SpliceEdit, type TRange, VERSION, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fitRatioForFewerLines, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, renderHtml, scanSectionXml, simulateWrap, simulateWrapKeepWord };
1082
+ export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BoundingBox, type CellCapability, 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 FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type GongmunFont, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type GongmunPresetInput, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type MeasureOptions, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SectionScan, type SpliceEdit, type TRange, VERSION, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fitRatioForFewerLines, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord };