kordoc 4.7.3 → 4.8.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 +19 -1
- package/dist/{-WYNJOQ6P.js → -URO5XBEB.js} +11 -9
- package/dist/{chunk-TXQQ7URG.js → chunk-2ANLGAUG.js} +2 -2
- package/dist/{chunk-LMHVMGEC.js → chunk-37SAM3LH.js} +3 -3
- package/dist/{chunk-W5NZYPRQ.js → chunk-3CBHCDYD.js} +41 -9
- package/dist/chunk-3CBHCDYD.js.map +1 -0
- package/dist/{chunk-QETZP25M.cjs → chunk-5IRX3TQP.cjs} +3 -3
- package/dist/{chunk-QETZP25M.cjs.map → chunk-5IRX3TQP.cjs.map} +1 -1
- package/dist/{chunk-3P5YCJQE.js → chunk-7OHDTS5Q.js} +2 -2
- package/dist/{chunk-KSATSTC5.js → chunk-BN33O25L.js} +1 -1
- package/dist/{chunk-4KGGVCYX.js.map → chunk-BN33O25L.js.map} +1 -1
- package/dist/{chunk-KE6DLZAW.cjs → chunk-CX2LRBC5.cjs} +11 -11
- package/dist/{chunk-KE6DLZAW.cjs.map → chunk-CX2LRBC5.cjs.map} +1 -1
- package/dist/{chunk-HJV4BVQI.js → chunk-E6OJKTYS.js} +2 -2
- package/dist/{chunk-NYLYIN55.js → chunk-F7RZZI5P.js} +3 -3
- package/dist/{chunk-R4LXZRYP.cjs → chunk-GGZ5PSJO.cjs} +4 -4
- package/dist/{chunk-R4LXZRYP.cjs.map → chunk-GGZ5PSJO.cjs.map} +1 -1
- package/dist/{chunk-JKJEBDP7.js → chunk-HFVMCUXF.js} +3 -3
- package/dist/{chunk-RQVFFSAO.js → chunk-HS4762CD.js} +2 -2
- package/dist/{chunk-E6DONLTM.cjs → chunk-J7DBL77B.cjs} +2 -2
- package/dist/{chunk-E6DONLTM.cjs.map → chunk-J7DBL77B.cjs.map} +1 -1
- package/dist/{chunk-IMFIACHP.js → chunk-L2Q3NLHX.js} +2 -2
- package/dist/{chunk-EV53YE3W.cjs → chunk-L5CDTOC3.cjs} +1 -1
- package/dist/chunk-L5CDTOC3.cjs.map +1 -0
- package/dist/{chunk-P663PYWV.js → chunk-NFCQ5XNT.js} +2 -2
- package/dist/{chunk-KEGAEHWO.js → chunk-OKE6G67G.js} +2 -2
- package/dist/{chunk-QGATKC4R.cjs → chunk-OKISH2NK.cjs} +6 -6
- package/dist/{chunk-QGATKC4R.cjs.map → chunk-OKISH2NK.cjs.map} +1 -1
- package/dist/{chunk-46F5RMU7.js → chunk-S4SMUQAT.js} +2 -2
- package/dist/{chunk-CGJDCZA3.js → chunk-TXRTH5BV.js} +2 -2
- package/dist/{chunk-XOO6YEZE.js → chunk-VPAYFTMH.js} +3 -3
- package/dist/{chunk-4HZN7EZZ.js → chunk-WG473BIB.js} +2 -2
- package/dist/{chunk-Y7T5Z4DC.js → chunk-WXC4HKSD.js} +3 -3
- package/dist/{chunk-4KGGVCYX.js → chunk-XINP35F4.js} +1 -1
- package/dist/{chunk-KSATSTC5.js.map → chunk-XINP35F4.js.map} +1 -1
- package/dist/{chunk-3NKSSL44.js → chunk-YB2TYOYY.js} +3 -3
- package/dist/{chunk-VZ3AQVBN.js → chunk-ZEQPTIWN.js} +2 -2
- package/dist/chunks-M64IY7AK.js +10 -0
- package/dist/cli.js +21 -21
- package/dist/{formula-PDMZMBIP.cjs → formula-3K5KC3VV.cjs} +9 -9
- package/dist/{formula-PDMZMBIP.cjs.map → formula-3K5KC3VV.cjs.map} +1 -1
- package/dist/{formula-V6EAYHMF.js → formula-7BNCJ55B.js} +3 -3
- package/dist/{formula-IFKZZPD2.js → formula-YRMQ7BTI.js} +4 -4
- package/dist/{image-ocr-75WGMVU6.cjs → image-ocr-CBMJIJTQ.cjs} +12 -12
- package/dist/{image-ocr-75WGMVU6.cjs.map → image-ocr-CBMJIJTQ.cjs.map} +1 -1
- package/dist/{image-ocr-B7TMIG3F.js → image-ocr-O7TKPDTY.js} +8 -8
- package/dist/{image-ocr-XHBZONFZ.js → image-ocr-XRVXVYKO.js} +6 -6
- package/dist/index.cjs +396 -364
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +37 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +16 -16
- package/dist/{model-bundle-Q4HQXJQG.js → model-bundle-GNDUKNME.js} +5 -5
- package/dist/{models-QQA7OQHY.js → models-TJ45RB2Z.js} +5 -5
- package/dist/{parser-Z36MZUHS.js → parser-5MLJHSRX.js} +7 -7
- package/dist/{parser-4CBOPTVY.cjs → parser-GIVQWVKJ.cjs} +27 -27
- package/dist/{parser-4CBOPTVY.cjs.map → parser-GIVQWVKJ.cjs.map} +1 -1
- package/dist/{parser-HT7GZOF2.js → parser-U3SMCGRK.js} +7 -7
- package/dist/pdf-ocr-BUBZA4EE.cjs +14 -0
- package/dist/{pdf-ocr-6ZNGDVC6.cjs.map → pdf-ocr-BUBZA4EE.cjs.map} +1 -1
- package/dist/pdf-ocr-HITVPJLV.js +13 -0
- package/dist/pdf-ocr-K4WOCJGJ.js +16 -0
- package/dist/{profile-io-ACYRLCSR.js → profile-io-VATWYLZX.js} +3 -3
- package/dist/{rasterize-QYCLEH2J.js → rasterize-PNRXMSL2.js} +2 -2
- package/dist/render-YY5RKZEB.js +10 -0
- package/dist/seal-5ZNJXOOQ.js +10 -0
- package/dist/{setup-MG3YYKXU.js → setup-OEUDZ4BT.js} +3 -3
- package/dist/{watch-AZIY6AWC.js → watch-USNQJXQC.js} +10 -10
- package/package.json +2 -2
- package/dist/chunk-EV53YE3W.cjs.map +0 -1
- package/dist/chunk-W5NZYPRQ.js.map +0 -1
- package/dist/chunks-LWAOHTK2.js +0 -10
- package/dist/pdf-ocr-6ZNGDVC6.cjs +0 -14
- package/dist/pdf-ocr-NTXRJI4T.js +0 -13
- package/dist/pdf-ocr-TYMCEUPH.js +0 -16
- package/dist/render-5Y2US4IM.js +0 -10
- package/dist/seal-VU6JS2QD.js +0 -10
- /package/dist/{-WYNJOQ6P.js.map → -URO5XBEB.js.map} +0 -0
- /package/dist/{chunk-TXQQ7URG.js.map → chunk-2ANLGAUG.js.map} +0 -0
- /package/dist/{chunk-LMHVMGEC.js.map → chunk-37SAM3LH.js.map} +0 -0
- /package/dist/{chunk-3P5YCJQE.js.map → chunk-7OHDTS5Q.js.map} +0 -0
- /package/dist/{chunk-HJV4BVQI.js.map → chunk-E6OJKTYS.js.map} +0 -0
- /package/dist/{chunk-NYLYIN55.js.map → chunk-F7RZZI5P.js.map} +0 -0
- /package/dist/{chunk-JKJEBDP7.js.map → chunk-HFVMCUXF.js.map} +0 -0
- /package/dist/{chunk-RQVFFSAO.js.map → chunk-HS4762CD.js.map} +0 -0
- /package/dist/{chunk-IMFIACHP.js.map → chunk-L2Q3NLHX.js.map} +0 -0
- /package/dist/{chunk-P663PYWV.js.map → chunk-NFCQ5XNT.js.map} +0 -0
- /package/dist/{chunk-KEGAEHWO.js.map → chunk-OKE6G67G.js.map} +0 -0
- /package/dist/{chunk-46F5RMU7.js.map → chunk-S4SMUQAT.js.map} +0 -0
- /package/dist/{chunk-CGJDCZA3.js.map → chunk-TXRTH5BV.js.map} +0 -0
- /package/dist/{chunk-XOO6YEZE.js.map → chunk-VPAYFTMH.js.map} +0 -0
- /package/dist/{chunk-4HZN7EZZ.js.map → chunk-WG473BIB.js.map} +0 -0
- /package/dist/{chunk-Y7T5Z4DC.js.map → chunk-WXC4HKSD.js.map} +0 -0
- /package/dist/{chunk-3NKSSL44.js.map → chunk-YB2TYOYY.js.map} +0 -0
- /package/dist/{chunk-VZ3AQVBN.js.map → chunk-ZEQPTIWN.js.map} +0 -0
- /package/dist/{chunks-LWAOHTK2.js.map → chunks-M64IY7AK.js.map} +0 -0
- /package/dist/{formula-V6EAYHMF.js.map → formula-7BNCJ55B.js.map} +0 -0
- /package/dist/{formula-IFKZZPD2.js.map → formula-YRMQ7BTI.js.map} +0 -0
- /package/dist/{image-ocr-B7TMIG3F.js.map → image-ocr-O7TKPDTY.js.map} +0 -0
- /package/dist/{image-ocr-XHBZONFZ.js.map → image-ocr-XRVXVYKO.js.map} +0 -0
- /package/dist/{model-bundle-Q4HQXJQG.js.map → model-bundle-GNDUKNME.js.map} +0 -0
- /package/dist/{models-QQA7OQHY.js.map → models-TJ45RB2Z.js.map} +0 -0
- /package/dist/{parser-Z36MZUHS.js.map → parser-5MLJHSRX.js.map} +0 -0
- /package/dist/{parser-HT7GZOF2.js.map → parser-U3SMCGRK.js.map} +0 -0
- /package/dist/{pdf-ocr-NTXRJI4T.js.map → pdf-ocr-HITVPJLV.js.map} +0 -0
- /package/dist/{pdf-ocr-TYMCEUPH.js.map → pdf-ocr-K4WOCJGJ.js.map} +0 -0
- /package/dist/{profile-io-ACYRLCSR.js.map → profile-io-VATWYLZX.js.map} +0 -0
- /package/dist/{rasterize-QYCLEH2J.js.map → rasterize-PNRXMSL2.js.map} +0 -0
- /package/dist/{render-5Y2US4IM.js.map → render-YY5RKZEB.js.map} +0 -0
- /package/dist/{seal-VU6JS2QD.js.map → seal-5ZNJXOOQ.js.map} +0 -0
- /package/dist/{setup-MG3YYKXU.js.map → setup-OEUDZ4BT.js.map} +0 -0
- /package/dist/{watch-AZIY6AWC.js.map → watch-USNQJXQC.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -274,11 +274,29 @@ interface ParseSuccess extends ParseResultBase {
|
|
|
274
274
|
warnings?: ParseWarning[];
|
|
275
275
|
/** 추출된 이미지 목록 — 마크다운에서 파일명으로 참조됨 */
|
|
276
276
|
images?: ExtractedImage[];
|
|
277
|
+
/**
|
|
278
|
+
* 페이지별 마크다운 (#68) — `blocks` 의 `pageNumber` 로 갈라 페이지마다 다시
|
|
279
|
+
* 마크다운을 만든 것. 페이지 경계의 신뢰도는 `metadata.pageMode` 를 따른다
|
|
280
|
+
* ("layout" = 실제 페이지, "section" = 섹션 근사). `pages` 옵션으로 범위를
|
|
281
|
+
* 줄이면 그 범위만 담긴다. 페이지 번호를 매기지 않는 포맷(DOCX 등)에서는 없고,
|
|
282
|
+
* XLSX 는 `pageCount` 와 같은 의미로 시트 한 장이 한 쪽이다.
|
|
283
|
+
*
|
|
284
|
+
* 여러 페이지에 걸친 표는 시작 페이지 한 블록이라, 표가 이어지는 중간
|
|
285
|
+
* 페이지의 `markdown` 은 빈 문자열일 수 있다 (현 IR 구조의 한계).
|
|
286
|
+
*/
|
|
287
|
+
pages?: PageMarkdown[];
|
|
277
288
|
/** 페이지별 텍스트 품질 신호 — PDF에서만 제공 */
|
|
278
289
|
pageQuality?: PageQuality[];
|
|
279
290
|
/** 문서 단위 품질 요약 — PDF에서만 제공 */
|
|
280
291
|
qualitySummary?: DocumentQualitySummary;
|
|
281
292
|
}
|
|
293
|
+
/** 페이지 한 장의 마크다운 (#68). ParseSuccess.pages 항목. */
|
|
294
|
+
interface PageMarkdown {
|
|
295
|
+
/** 원본 페이지 번호 (1-based) */
|
|
296
|
+
pageNumber: number;
|
|
297
|
+
/** 그 페이지 블록만으로 만든 마크다운. 블록이 없으면 빈 문자열 */
|
|
298
|
+
markdown: string;
|
|
299
|
+
}
|
|
282
300
|
/** 페이지별 텍스트 품질 신호 (PDF 전용). 자세한 설명은 src/pdf/quality.ts */
|
|
283
301
|
interface PageQuality {
|
|
284
302
|
page: number;
|
|
@@ -1749,6 +1767,29 @@ declare function detectZipFormat(buffer: ArrayBuffer): Promise<"hwpx" | "xlsx" |
|
|
|
1749
1767
|
|
|
1750
1768
|
declare function blocksToMarkdown(blocks: IRBlock[]): string;
|
|
1751
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* 페이지별 마크다운 사영 (#68)
|
|
1772
|
+
*
|
|
1773
|
+
* 문서를 다시 파싱하지 않고 이미 만들어진 `IRBlock.pageNumber` 로만 블록을 갈라
|
|
1774
|
+
* 페이지마다 `blocksToMarkdown()` 을 돌린다. 페이지 번호의 신뢰도는 파서가
|
|
1775
|
+
* 정하는 것이고(`metadata.pageMode` — "layout" 은 실제 페이지, "section" 은
|
|
1776
|
+
* 섹션 근사), 여기서는 그 값을 그대로 존중한다.
|
|
1777
|
+
*/
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* 블록을 페이지 번호로 묶어 페이지별 마크다운을 만든다.
|
|
1781
|
+
*
|
|
1782
|
+
* - 어떤 블록에도 페이지 번호가 없으면 `undefined` — 페이지 개념이 없는 포맷에
|
|
1783
|
+
* "전부 1페이지" 같은 없는 사실을 만들어 내지 않는다.
|
|
1784
|
+
* - 번호가 없는 블록은 **직전 블록의 페이지로 이어붙인다.** 블록은 읽기 순서라
|
|
1785
|
+
* 이게 원문 위치에 가장 가깝고, 무엇보다 어느 페이지에도 안 실려 조용히
|
|
1786
|
+
* 사라지는 블록이 생기지 않는다. 선두의 번호 없는 블록은 첫 실번호 페이지로.
|
|
1787
|
+
* - 관측된 최소~최대 페이지 사이의 빈 페이지도 항목으로 낸다. 여러 페이지에
|
|
1788
|
+
* 걸친 표는 시작 페이지 한 블록이라 중간 페이지가 실제로 비어 있고, 이때
|
|
1789
|
+
* 항목을 빼면 소비자가 배열 길이로 페이지 수를 셀 수 없다.
|
|
1790
|
+
*/
|
|
1791
|
+
declare function blocksToPages(blocks: IRBlock[]): PageMarkdown[] | undefined;
|
|
1792
|
+
|
|
1752
1793
|
/** kordoc 공용 유틸리티 */
|
|
1753
1794
|
declare const VERSION: string;
|
|
1754
1795
|
|
|
@@ -1822,4 +1863,4 @@ interface FillFormOutput {
|
|
|
1822
1863
|
*/
|
|
1823
1864
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
1824
1865
|
|
|
1825
|
-
export { BUILTIN_TEMPLATES, type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type BuiltinTemplate, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type ChunkOptions, type ClickHereField, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillInput, type FillOutputFormat, type FillResult, type FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type FormatProfile, type GongmunFont, type GongmunLintFinding, 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 PageOptions, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PlaceSealResult, type PrintOptions, type PrintPreset, type RedactHit, type RedactOptions, type RedactRule, type RedactTextResult, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, gongmunLintWarnings, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderHtml, renderHwpxToSvg, resolveBuiltinTemplate, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
|
|
1866
|
+
export { BUILTIN_TEMPLATES, type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type BuiltinTemplate, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type ChunkOptions, type ClickHereField, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillInput, type FillOutputFormat, type FillResult, type FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type FormatProfile, type GongmunFont, type GongmunLintFinding, 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 PageMarkdown, type PageOptions, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PlaceSealResult, type PrintOptions, type PrintPreset, type RedactHit, type RedactOptions, type RedactRule, type RedactTextResult, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, gongmunLintWarnings, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderHtml, renderHwpxToSvg, resolveBuiltinTemplate, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
|
package/dist/index.d.ts
CHANGED
|
@@ -274,11 +274,29 @@ interface ParseSuccess extends ParseResultBase {
|
|
|
274
274
|
warnings?: ParseWarning[];
|
|
275
275
|
/** 추출된 이미지 목록 — 마크다운에서 파일명으로 참조됨 */
|
|
276
276
|
images?: ExtractedImage[];
|
|
277
|
+
/**
|
|
278
|
+
* 페이지별 마크다운 (#68) — `blocks` 의 `pageNumber` 로 갈라 페이지마다 다시
|
|
279
|
+
* 마크다운을 만든 것. 페이지 경계의 신뢰도는 `metadata.pageMode` 를 따른다
|
|
280
|
+
* ("layout" = 실제 페이지, "section" = 섹션 근사). `pages` 옵션으로 범위를
|
|
281
|
+
* 줄이면 그 범위만 담긴다. 페이지 번호를 매기지 않는 포맷(DOCX 등)에서는 없고,
|
|
282
|
+
* XLSX 는 `pageCount` 와 같은 의미로 시트 한 장이 한 쪽이다.
|
|
283
|
+
*
|
|
284
|
+
* 여러 페이지에 걸친 표는 시작 페이지 한 블록이라, 표가 이어지는 중간
|
|
285
|
+
* 페이지의 `markdown` 은 빈 문자열일 수 있다 (현 IR 구조의 한계).
|
|
286
|
+
*/
|
|
287
|
+
pages?: PageMarkdown[];
|
|
277
288
|
/** 페이지별 텍스트 품질 신호 — PDF에서만 제공 */
|
|
278
289
|
pageQuality?: PageQuality[];
|
|
279
290
|
/** 문서 단위 품질 요약 — PDF에서만 제공 */
|
|
280
291
|
qualitySummary?: DocumentQualitySummary;
|
|
281
292
|
}
|
|
293
|
+
/** 페이지 한 장의 마크다운 (#68). ParseSuccess.pages 항목. */
|
|
294
|
+
interface PageMarkdown {
|
|
295
|
+
/** 원본 페이지 번호 (1-based) */
|
|
296
|
+
pageNumber: number;
|
|
297
|
+
/** 그 페이지 블록만으로 만든 마크다운. 블록이 없으면 빈 문자열 */
|
|
298
|
+
markdown: string;
|
|
299
|
+
}
|
|
282
300
|
/** 페이지별 텍스트 품질 신호 (PDF 전용). 자세한 설명은 src/pdf/quality.ts */
|
|
283
301
|
interface PageQuality {
|
|
284
302
|
page: number;
|
|
@@ -1749,6 +1767,29 @@ declare function detectZipFormat(buffer: ArrayBuffer): Promise<"hwpx" | "xlsx" |
|
|
|
1749
1767
|
|
|
1750
1768
|
declare function blocksToMarkdown(blocks: IRBlock[]): string;
|
|
1751
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* 페이지별 마크다운 사영 (#68)
|
|
1772
|
+
*
|
|
1773
|
+
* 문서를 다시 파싱하지 않고 이미 만들어진 `IRBlock.pageNumber` 로만 블록을 갈라
|
|
1774
|
+
* 페이지마다 `blocksToMarkdown()` 을 돌린다. 페이지 번호의 신뢰도는 파서가
|
|
1775
|
+
* 정하는 것이고(`metadata.pageMode` — "layout" 은 실제 페이지, "section" 은
|
|
1776
|
+
* 섹션 근사), 여기서는 그 값을 그대로 존중한다.
|
|
1777
|
+
*/
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* 블록을 페이지 번호로 묶어 페이지별 마크다운을 만든다.
|
|
1781
|
+
*
|
|
1782
|
+
* - 어떤 블록에도 페이지 번호가 없으면 `undefined` — 페이지 개념이 없는 포맷에
|
|
1783
|
+
* "전부 1페이지" 같은 없는 사실을 만들어 내지 않는다.
|
|
1784
|
+
* - 번호가 없는 블록은 **직전 블록의 페이지로 이어붙인다.** 블록은 읽기 순서라
|
|
1785
|
+
* 이게 원문 위치에 가장 가깝고, 무엇보다 어느 페이지에도 안 실려 조용히
|
|
1786
|
+
* 사라지는 블록이 생기지 않는다. 선두의 번호 없는 블록은 첫 실번호 페이지로.
|
|
1787
|
+
* - 관측된 최소~최대 페이지 사이의 빈 페이지도 항목으로 낸다. 여러 페이지에
|
|
1788
|
+
* 걸친 표는 시작 페이지 한 블록이라 중간 페이지가 실제로 비어 있고, 이때
|
|
1789
|
+
* 항목을 빼면 소비자가 배열 길이로 페이지 수를 셀 수 없다.
|
|
1790
|
+
*/
|
|
1791
|
+
declare function blocksToPages(blocks: IRBlock[]): PageMarkdown[] | undefined;
|
|
1792
|
+
|
|
1752
1793
|
/** kordoc 공용 유틸리티 */
|
|
1753
1794
|
declare const VERSION: string;
|
|
1754
1795
|
|
|
@@ -1822,4 +1863,4 @@ interface FillFormOutput {
|
|
|
1822
1863
|
*/
|
|
1823
1864
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
1824
1865
|
|
|
1825
|
-
export { BUILTIN_TEMPLATES, type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type BuiltinTemplate, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type ChunkOptions, type ClickHereField, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillInput, type FillOutputFormat, type FillResult, type FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type FormatProfile, type GongmunFont, type GongmunLintFinding, 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 PageOptions, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PlaceSealResult, type PrintOptions, type PrintPreset, type RedactHit, type RedactOptions, type RedactRule, type RedactTextResult, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, gongmunLintWarnings, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderHtml, renderHwpxToSvg, resolveBuiltinTemplate, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
|
|
1866
|
+
export { BUILTIN_TEMPLATES, type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type BuiltinTemplate, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type ChunkOptions, type ClickHereField, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillInput, type FillOutputFormat, type FillResult, type FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type FormatProfile, type GongmunFont, type GongmunLintFinding, 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 PageMarkdown, type PageOptions, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PlaceSealResult, type PrintOptions, type PrintPreset, type RedactHit, type RedactOptions, type RedactRule, type RedactTextResult, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, gongmunLintWarnings, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderHtml, renderHwpxToSvg, resolveBuiltinTemplate, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
flattenLayoutTables,
|
|
9
9
|
inlineImagesIntoMarkdown,
|
|
10
10
|
mapPuaText
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NFCQ5XNT.js";
|
|
12
12
|
import {
|
|
13
13
|
parsePageRange
|
|
14
14
|
} from "./chunk-GE43BE46.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
HEADING_RATIO_H1,
|
|
17
17
|
HEADING_RATIO_H2,
|
|
18
18
|
HEADING_RATIO_H3
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BN33O25L.js";
|
|
20
20
|
import {
|
|
21
21
|
KordocError,
|
|
22
22
|
VERSION,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
sanitizeHref,
|
|
30
30
|
stripDtd,
|
|
31
31
|
toArrayBuffer
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-S4SMUQAT.js";
|
|
33
33
|
|
|
34
34
|
// src/index.ts
|
|
35
35
|
import { readFile } from "fs/promises";
|
|
@@ -22205,6 +22205,29 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
22205
22205
|
};
|
|
22206
22206
|
}
|
|
22207
22207
|
|
|
22208
|
+
// src/page-markdown.ts
|
|
22209
|
+
function blocksToPages(blocks) {
|
|
22210
|
+
const firstNumbered = blocks.find((b) => typeof b.pageNumber === "number")?.pageNumber;
|
|
22211
|
+
if (firstNumbered === void 0) return void 0;
|
|
22212
|
+
const byPage = /* @__PURE__ */ new Map();
|
|
22213
|
+
let current = firstNumbered;
|
|
22214
|
+
for (const block of blocks) {
|
|
22215
|
+
if (typeof block.pageNumber === "number") current = block.pageNumber;
|
|
22216
|
+
const bucket = byPage.get(current);
|
|
22217
|
+
if (bucket) bucket.push(block);
|
|
22218
|
+
else byPage.set(current, [block]);
|
|
22219
|
+
}
|
|
22220
|
+
const numbers = [...byPage.keys()];
|
|
22221
|
+
const min = Math.min(...numbers);
|
|
22222
|
+
const max = Math.max(...numbers);
|
|
22223
|
+
const pages = [];
|
|
22224
|
+
for (let pageNumber = min; pageNumber <= max; pageNumber++) {
|
|
22225
|
+
const pageBlocks = byPage.get(pageNumber);
|
|
22226
|
+
pages.push({ pageNumber, markdown: pageBlocks ? blocksToMarkdown(pageBlocks) : "" });
|
|
22227
|
+
}
|
|
22228
|
+
return pages;
|
|
22229
|
+
}
|
|
22230
|
+
|
|
22208
22231
|
// src/hwpx/generator.ts
|
|
22209
22232
|
import JSZip8 from "jszip";
|
|
22210
22233
|
|
|
@@ -31611,6 +31634,14 @@ async function parse(input, options) {
|
|
|
31611
31634
|
return { success: false, fileType: "unknown", error: "\uBE48 \uBC84\uD37C\uC774\uAC70\uB098 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC785\uB825\uC785\uB2C8\uB2E4.", code: "EMPTY_INPUT" };
|
|
31612
31635
|
}
|
|
31613
31636
|
const format = detectFormat(buffer);
|
|
31637
|
+
const result = await dispatch(format, buffer, opts);
|
|
31638
|
+
if (result.success && !result.pages) {
|
|
31639
|
+
const pages = blocksToPages(result.blocks);
|
|
31640
|
+
if (pages) return { ...result, pages };
|
|
31641
|
+
}
|
|
31642
|
+
return result;
|
|
31643
|
+
}
|
|
31644
|
+
async function dispatch(format, buffer, opts) {
|
|
31614
31645
|
switch (format) {
|
|
31615
31646
|
case "hwpx": {
|
|
31616
31647
|
const zipFormat = await detectZipFormat(buffer);
|
|
@@ -31637,7 +31668,7 @@ async function parse(input, options) {
|
|
|
31637
31668
|
}
|
|
31638
31669
|
async function parseImage(buffer, options) {
|
|
31639
31670
|
try {
|
|
31640
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
31671
|
+
const { parseImageDocument } = await import("./image-ocr-XRVXVYKO.js");
|
|
31641
31672
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
31642
31673
|
return {
|
|
31643
31674
|
success: true,
|
|
@@ -31696,7 +31727,7 @@ async function parseHwp(buffer, options) {
|
|
|
31696
31727
|
async function parsePdf(buffer, options) {
|
|
31697
31728
|
let parsePdfDocument;
|
|
31698
31729
|
try {
|
|
31699
|
-
const mod = await import("./parser-
|
|
31730
|
+
const mod = await import("./parser-5MLJHSRX.js");
|
|
31700
31731
|
parsePdfDocument = mod.parsePdfDocument;
|
|
31701
31732
|
} catch {
|
|
31702
31733
|
return {
|
|
@@ -31797,6 +31828,7 @@ export {
|
|
|
31797
31828
|
applySplices,
|
|
31798
31829
|
blocksToChunks,
|
|
31799
31830
|
blocksToMarkdown,
|
|
31831
|
+
blocksToPages,
|
|
31800
31832
|
blocksToPdf,
|
|
31801
31833
|
buildParagraphSplices,
|
|
31802
31834
|
buildRangeSplices,
|