kordoc 4.18.13 → 4.19.1
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 +3 -1
- package/dist/{-DC2OO5KO.js → -LYUUVVQF.js} +11 -11
- package/dist/{chunk-ISC2TH24.js → chunk-4WTJS6ES.js} +2 -2
- package/dist/{chunk-SVIOP7PE.js → chunk-5AZQEMMG.js} +7 -7
- package/dist/{chunk-SVIOP7PE.js.map → chunk-5AZQEMMG.js.map} +1 -1
- package/dist/{chunk-GUH6HYSZ.js → chunk-6KOQPPLX.js} +25 -22
- package/dist/chunk-6KOQPPLX.js.map +1 -0
- package/dist/{chunk-PN5WWW56.js → chunk-7L5GY54Q.js} +2 -2
- package/dist/{chunk-PN5WWW56.js.map → chunk-7L5GY54Q.js.map} +1 -1
- package/dist/{chunk-PHMWSWHJ.js → chunk-7XRI4FL4.js} +2 -2
- package/dist/{chunk-32ZUIHSY.js → chunk-ADBES5QJ.js} +3 -3
- package/dist/{chunk-JWTZ3OVZ.js → chunk-BDTWXJNM.js} +2 -2
- package/dist/{chunk-INESPVEV.js → chunk-CL3CJ7X5.js} +3 -3
- package/dist/{chunk-VDEENOPW.js → chunk-DQHDI567.js} +2 -2
- package/dist/{chunk-ZNY5BRV6.js → chunk-FEGRQA3Q.js} +4 -4
- package/dist/{chunk-3FGHQWJP.cjs → chunk-FNX3ZAYB.cjs} +22 -22
- package/dist/{chunk-3FGHQWJP.cjs.map → chunk-FNX3ZAYB.cjs.map} +1 -1
- package/dist/{chunk-GGMIPTM5.cjs → chunk-GPNPYBXJ.cjs} +12 -12
- package/dist/{chunk-GGMIPTM5.cjs.map → chunk-GPNPYBXJ.cjs.map} +1 -1
- package/dist/{chunk-6CQZMVXW.cjs → chunk-HMJXB7ZE.cjs} +3 -3
- package/dist/{chunk-6CQZMVXW.cjs.map → chunk-HMJXB7ZE.cjs.map} +1 -1
- package/dist/{chunk-IRN5SDY2.js → chunk-JA5B4NPF.js} +2 -2
- package/dist/{chunk-GSW7W7AL.js → chunk-JNIJPP4B.js} +7 -4
- package/dist/chunk-JNIJPP4B.js.map +1 -0
- package/dist/{chunk-EZSWBHHI.js → chunk-KYFP5LDC.js} +2 -2
- package/dist/{chunk-XVB3PUPJ.js → chunk-L5N5UQBP.js} +10 -4
- package/dist/chunk-L5N5UQBP.js.map +1 -0
- package/dist/{chunk-6AYTYTFY.js → chunk-MSUGYK6A.js} +3 -3
- package/dist/{chunk-K6WSMTVU.cjs → chunk-RHMIEEAZ.cjs} +2 -2
- package/dist/{chunk-K6WSMTVU.cjs.map → chunk-RHMIEEAZ.cjs.map} +1 -1
- package/dist/{chunk-JKHU7HID.js → chunk-TRUR4RUJ.js} +95 -11
- package/dist/chunk-TRUR4RUJ.js.map +1 -0
- package/dist/{chunk-DHEUQXXR.js → chunk-UAAYIEIK.js} +2 -2
- package/dist/{chunk-RQEDNI4P.cjs → chunk-UOXOYZU4.cjs} +3 -3
- package/dist/{chunk-RQEDNI4P.cjs.map → chunk-UOXOYZU4.cjs.map} +1 -1
- package/dist/{chunk-6FW3AZWN.cjs → chunk-W5NXOMCD.cjs} +125 -35
- package/dist/chunk-W5NXOMCD.cjs.map +1 -0
- package/dist/{chunk-V7LKQNC4.js → chunk-X6ME7YYS.js} +2 -2
- package/dist/{chunk-LKA7Z2NH.js → chunk-XFZMRCGJ.js} +2 -2
- package/dist/{chunk-JPSLMPFI.js → chunk-YLST4S4P.js} +103 -13
- package/dist/chunk-YLST4S4P.js.map +1 -0
- package/dist/{chunk-EBXJ45VZ.js → chunk-Z2WI3E4N.js} +2 -2
- package/dist/{chunk-EBXJ45VZ.js.map → chunk-Z2WI3E4N.js.map} +1 -1
- package/dist/{chunk-7LOD4IGO.js → chunk-ZTGTFO52.js} +4 -4
- package/dist/chunks-T67OQGPJ.js +10 -0
- package/dist/cli.js +39 -28
- package/dist/cli.js.map +1 -1
- package/dist/{formula-DAMFHLQO.js → formula-G4YA7SNQ.js} +3 -3
- package/dist/{formula-HJNQGPRC.cjs → formula-J3UUIPCX.cjs} +9 -9
- package/dist/{formula-HJNQGPRC.cjs.map → formula-J3UUIPCX.cjs.map} +1 -1
- package/dist/{formula-YCAO5IVW.js → formula-QSZRYZ44.js} +4 -4
- package/dist/{image-ocr-AZ25IOC7.cjs → image-ocr-467KLV3F.cjs} +15 -15
- package/dist/{image-ocr-AZ25IOC7.cjs.map → image-ocr-467KLV3F.cjs.map} +1 -1
- package/dist/{image-ocr-VH54SDZ7.js → image-ocr-I52GBXRE.js} +6 -6
- package/dist/{image-ocr-PAF76DAW.js → image-ocr-ZP3F4MUY.js} +9 -9
- package/dist/index.cjs +669 -663
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +26 -20
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +25 -23
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-53CHDYCG.js → model-bundle-FEUM7XXS.js} +5 -5
- package/dist/{models-UVLAKK3M.js → models-6QCNX5YR.js} +5 -5
- package/dist/{parser-I4D3TRGU.js → parser-6EIBURDE.js} +179 -13
- package/dist/parser-6EIBURDE.js.map +1 -0
- package/dist/{parser-HWAOPQYK.cjs → parser-BIJBX2D5.cjs} +393 -227
- package/dist/parser-BIJBX2D5.cjs.map +1 -0
- package/dist/{parser-Z6PHB54O.js → parser-YX4LGKIK.js} +176 -10
- package/dist/parser-YX4LGKIK.js.map +1 -0
- package/dist/pdf-ocr-DXQIMO77.cjs +17 -0
- package/dist/{pdf-ocr-HR6CXGTX.cjs.map → pdf-ocr-DXQIMO77.cjs.map} +1 -1
- package/dist/pdf-ocr-MESGGING.js +20 -0
- package/dist/pdf-ocr-YSRBRIPR.js +16 -0
- package/dist/{profile-io-WHCWCOPW.js → profile-io-ATHFEUAP.js} +3 -3
- package/dist/{rasterize-5DZ3DHGH.js → rasterize-SG3CLXMQ.js} +3 -3
- package/dist/{redact-doc-RNJVMFGQ.js → redact-doc-K3S4HFHU.js} +11 -11
- package/dist/{render-NZ6RA6SW.js → render-6CQJM7VE.js} +7 -7
- package/dist/seal-SMO4544N.js +10 -0
- package/dist/{setup-U3EQNK4Z.js → setup-CZ5KHGPI.js} +3 -3
- package/dist/visual-UWYGQLOU.js +20 -0
- package/dist/{watch-GB2M7XU6.js → watch-RQRIGLFF.js} +12 -12
- package/package.json +3 -2
- package/dist/chunk-6FW3AZWN.cjs.map +0 -1
- package/dist/chunk-GSW7W7AL.js.map +0 -1
- package/dist/chunk-GUH6HYSZ.js.map +0 -1
- package/dist/chunk-JKHU7HID.js.map +0 -1
- package/dist/chunk-JPSLMPFI.js.map +0 -1
- package/dist/chunk-XVB3PUPJ.js.map +0 -1
- package/dist/chunks-JZW2TXIZ.js +0 -10
- package/dist/parser-HWAOPQYK.cjs.map +0 -1
- package/dist/parser-I4D3TRGU.js.map +0 -1
- package/dist/parser-Z6PHB54O.js.map +0 -1
- package/dist/pdf-ocr-F4ICXO7W.js +0 -20
- package/dist/pdf-ocr-HR6CXGTX.cjs +0 -17
- package/dist/pdf-ocr-JI3K7JIN.js +0 -16
- package/dist/seal-WHJ6O5HT.js +0 -10
- package/dist/visual-JDAS4R43.js +0 -20
- /package/dist/{-DC2OO5KO.js.map → -LYUUVVQF.js.map} +0 -0
- /package/dist/{chunk-ISC2TH24.js.map → chunk-4WTJS6ES.js.map} +0 -0
- /package/dist/{chunk-PHMWSWHJ.js.map → chunk-7XRI4FL4.js.map} +0 -0
- /package/dist/{chunk-32ZUIHSY.js.map → chunk-ADBES5QJ.js.map} +0 -0
- /package/dist/{chunk-JWTZ3OVZ.js.map → chunk-BDTWXJNM.js.map} +0 -0
- /package/dist/{chunk-INESPVEV.js.map → chunk-CL3CJ7X5.js.map} +0 -0
- /package/dist/{chunk-VDEENOPW.js.map → chunk-DQHDI567.js.map} +0 -0
- /package/dist/{chunk-ZNY5BRV6.js.map → chunk-FEGRQA3Q.js.map} +0 -0
- /package/dist/{chunk-IRN5SDY2.js.map → chunk-JA5B4NPF.js.map} +0 -0
- /package/dist/{chunk-EZSWBHHI.js.map → chunk-KYFP5LDC.js.map} +0 -0
- /package/dist/{chunk-6AYTYTFY.js.map → chunk-MSUGYK6A.js.map} +0 -0
- /package/dist/{chunk-DHEUQXXR.js.map → chunk-UAAYIEIK.js.map} +0 -0
- /package/dist/{chunk-V7LKQNC4.js.map → chunk-X6ME7YYS.js.map} +0 -0
- /package/dist/{chunk-LKA7Z2NH.js.map → chunk-XFZMRCGJ.js.map} +0 -0
- /package/dist/{chunk-7LOD4IGO.js.map → chunk-ZTGTFO52.js.map} +0 -0
- /package/dist/{chunks-JZW2TXIZ.js.map → chunks-T67OQGPJ.js.map} +0 -0
- /package/dist/{formula-DAMFHLQO.js.map → formula-G4YA7SNQ.js.map} +0 -0
- /package/dist/{formula-YCAO5IVW.js.map → formula-QSZRYZ44.js.map} +0 -0
- /package/dist/{image-ocr-VH54SDZ7.js.map → image-ocr-I52GBXRE.js.map} +0 -0
- /package/dist/{image-ocr-PAF76DAW.js.map → image-ocr-ZP3F4MUY.js.map} +0 -0
- /package/dist/{model-bundle-53CHDYCG.js.map → model-bundle-FEUM7XXS.js.map} +0 -0
- /package/dist/{models-UVLAKK3M.js.map → models-6QCNX5YR.js.map} +0 -0
- /package/dist/{pdf-ocr-F4ICXO7W.js.map → pdf-ocr-MESGGING.js.map} +0 -0
- /package/dist/{pdf-ocr-JI3K7JIN.js.map → pdf-ocr-YSRBRIPR.js.map} +0 -0
- /package/dist/{profile-io-WHCWCOPW.js.map → profile-io-ATHFEUAP.js.map} +0 -0
- /package/dist/{rasterize-5DZ3DHGH.js.map → rasterize-SG3CLXMQ.js.map} +0 -0
- /package/dist/{redact-doc-RNJVMFGQ.js.map → redact-doc-K3S4HFHU.js.map} +0 -0
- /package/dist/{render-NZ6RA6SW.js.map → render-6CQJM7VE.js.map} +0 -0
- /package/dist/{seal-WHJ6O5HT.js.map → seal-SMO4544N.js.map} +0 -0
- /package/dist/{setup-U3EQNK4Z.js.map → setup-CZ5KHGPI.js.map} +0 -0
- /package/dist/{visual-JDAS4R43.js.map → visual-UWYGQLOU.js.map} +0 -0
- /package/dist/{watch-GB2M7XU6.js.map → watch-RQRIGLFF.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -116,6 +116,8 @@ interface IRTable {
|
|
|
116
116
|
classification?: TableClassificationSummary;
|
|
117
117
|
/** 원본 표 식별자(HWPX `hp:tbl id`) — 렌더 region(`RenderRegion.sourceId`)과의 조인 키 */
|
|
118
118
|
sourceId?: string;
|
|
119
|
+
/** `tableFormat: "gfm"` 관계 표지의 표 id(`t1`, `t2` …) — 문서 블록 트리 전위 순회 순번. 그 옵션으로 렌더할 때만 채워진다(원본 id 아님) */
|
|
120
|
+
markdownId?: string;
|
|
119
121
|
/** 렌더 인프라가 준 페이지 로컬 pt 조각(다중 페이지 표는 여럿) — extractTables 가 채운다 */
|
|
120
122
|
regions?: BoundingBox[];
|
|
121
123
|
/** 표 캡션 (예: "표 1. 부서별 예산") — v3.0 */
|
|
@@ -206,6 +208,9 @@ interface ParseOptions {
|
|
|
206
208
|
/** 모든 표를 HTML 로 — 파이프 표도 HTML 표로 옮기고, 표마다 태그를 한 줄씩 들여써 낸다(BeautifulSoup prettify 모양, 첫 행 `<th>`).
|
|
207
209
|
* HTML 표만 다루는 소비자·채점기용. 기본 false(병합·중첩 없는 표는 GFM 파이프 표) */
|
|
208
210
|
htmlTables?: boolean;
|
|
211
|
+
/** `"gfm"`: 모든 표를 HTML 없이 GFM 파이프 표로 — 세로 병합 칸은 덮인 행마다 같은 값, 가로 병합 칸은 시작 칸에만 값, 셀 안 표는 부모 표 뒤 독립 표로 꺼내고
|
|
212
|
+
* 부모·자식 관계를 `<!-- <table id="t2" parent_id="t1" /> -->` 표지로 남긴다(RAG 색인용). `htmlTables` 와 함께 쓸 수 없다. 기본: 병합·중첩 표는 HTML */
|
|
213
|
+
tableFormat?: "gfm";
|
|
209
214
|
/** 표 오른쪽 끝의 빈 열(서식 문서의 입력란) 보존 (#47).
|
|
210
215
|
* 기본 false: 마크다운 가독성을 위해 후행 빈 열을 트림.
|
|
211
216
|
* 양식 인식 경로(parse_form·fill)는 내부적으로 항상 켠다. */
|
|
@@ -1568,7 +1573,13 @@ declare function applySplices(xml: string, splices: SpliceEdit[]): string;
|
|
|
1568
1573
|
/** 2-pass colSpan/rowSpan 테이블 빌더 및 Markdown 변환 */
|
|
1569
1574
|
|
|
1570
1575
|
declare function flattenLayoutTables(blocks: IRBlock[]): IRBlock[];
|
|
1571
|
-
|
|
1576
|
+
/** blocksToMarkdown 렌더 옵션 */
|
|
1577
|
+
interface MarkdownOptions {
|
|
1578
|
+
/** 표 출력 형식 (`ParseOptions.tableFormat`). "gfm": 모든 표를 HTML 없이 GFM 파이프 표로 — 셀 안 표는 부모 뒤 독립 표로 꺼내고
|
|
1579
|
+
* 부모·자식 관계를 HTML 주석 표지로 남긴다. 기본(미지정)은 병합·중첩 표를 HTML 로 */
|
|
1580
|
+
tableFormat?: "gfm";
|
|
1581
|
+
}
|
|
1582
|
+
declare function blocksToMarkdown(blocks: IRBlock[], options?: MarkdownOptions): string;
|
|
1572
1583
|
/**
|
|
1573
1584
|
* 셀에 GFM 표 문법으로 담을 수 없는 구조 콘텐츠(중첩표·구분선)가 있는가 (#76 Task 4) — hasNestedTables 의 일반화.
|
|
1574
1585
|
* 이미지는 GFM 셀에 `` 로 인라인할 수 있어 여기 세지 않는다 — 대신 GFM 경로가 blocks 를 직접 직렬화해
|
|
@@ -1762,6 +1773,8 @@ interface ChunkOptions {
|
|
|
1762
1773
|
* "block": IRBlock 1개 = 청크 1개
|
|
1763
1774
|
*/
|
|
1764
1775
|
granularity?: "block" | "section";
|
|
1776
|
+
/** 표 출력 형식 — `ParseOptions.tableFormat` 과 같다. "gfm" 이면 표 id 를 문서 전체 순번으로 붙인 뒤 청크마다 렌더한다 */
|
|
1777
|
+
tableFormat?: "gfm";
|
|
1765
1778
|
}
|
|
1766
1779
|
declare function blocksToChunks(blocks: IRBlock[], options?: ChunkOptions): DocChunk[];
|
|
1767
1780
|
|
|
@@ -2340,4 +2353,4 @@ interface FillFormOutput {
|
|
|
2340
2353
|
*/
|
|
2341
2354
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
2342
2355
|
|
|
2343
|
-
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 ClassifyContext, type ClickHereField, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractRegionOptions, type ExtractTableVisualOptions, type ExtractedImage, type ExtractedTable, type ExtractedTableCrop, 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 MuncheLineKind, type MuncheLintFinding, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageBBox, 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 RegionAsset, type RenderAsset, type RenderDocumentOptions, type RenderDocumentResult, type RenderFormat, type RenderObjectType, type RenderRegion, type RenderScene, type RenderSourceFormat, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type ScenePage, type SceneRenderOptions, type SceneRenderResult, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, type TableRepresentation, type TableVisualPolicy, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, chooseTableRepresentation, classifyTable, classifyTableTree, collectTableBlocks, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, extractRenderedRegions, extractTables, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, flattenLayoutTables, formatFillValue, gongmunLintWarnings, hasStructuredCellContent, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, lintMuncheText, markdownToHwpx, markdownToPdf, measureTextWidth, muncheLintWarnings, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parsePptx, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderDocument, renderDocumentToScene, renderHtml, renderHwp5Pages, renderHwpxToSvg, renderSceneToHtml, resolveBuiltinTemplate, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, usesGaejosikMunche, validateHwpx };
|
|
2356
|
+
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 ClassifyContext, type ClickHereField, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractRegionOptions, type ExtractTableVisualOptions, type ExtractedImage, type ExtractedTable, type ExtractedTableCrop, 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 MarkdownOptions, type MarkdownToHwpxOptions, type MeasureOptions, type MuncheLineKind, type MuncheLintFinding, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageBBox, 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 RegionAsset, type RenderAsset, type RenderDocumentOptions, type RenderDocumentResult, type RenderFormat, type RenderObjectType, type RenderRegion, type RenderScene, type RenderSourceFormat, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type ScenePage, type SceneRenderOptions, type SceneRenderResult, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, type TableRepresentation, type TableVisualPolicy, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, chooseTableRepresentation, classifyTable, classifyTableTree, collectTableBlocks, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, extractRenderedRegions, extractTables, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, flattenLayoutTables, formatFillValue, gongmunLintWarnings, hasStructuredCellContent, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, lintMuncheText, markdownToHwpx, markdownToPdf, measureTextWidth, muncheLintWarnings, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parsePptx, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderDocument, renderDocumentToScene, renderHtml, renderHwp5Pages, renderHwpxToSvg, renderSceneToHtml, resolveBuiltinTemplate, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, usesGaejosikMunche, validateHwpx };
|
package/dist/index.d.ts
CHANGED
|
@@ -116,6 +116,8 @@ interface IRTable {
|
|
|
116
116
|
classification?: TableClassificationSummary;
|
|
117
117
|
/** 원본 표 식별자(HWPX `hp:tbl id`) — 렌더 region(`RenderRegion.sourceId`)과의 조인 키 */
|
|
118
118
|
sourceId?: string;
|
|
119
|
+
/** `tableFormat: "gfm"` 관계 표지의 표 id(`t1`, `t2` …) — 문서 블록 트리 전위 순회 순번. 그 옵션으로 렌더할 때만 채워진다(원본 id 아님) */
|
|
120
|
+
markdownId?: string;
|
|
119
121
|
/** 렌더 인프라가 준 페이지 로컬 pt 조각(다중 페이지 표는 여럿) — extractTables 가 채운다 */
|
|
120
122
|
regions?: BoundingBox[];
|
|
121
123
|
/** 표 캡션 (예: "표 1. 부서별 예산") — v3.0 */
|
|
@@ -206,6 +208,9 @@ interface ParseOptions {
|
|
|
206
208
|
/** 모든 표를 HTML 로 — 파이프 표도 HTML 표로 옮기고, 표마다 태그를 한 줄씩 들여써 낸다(BeautifulSoup prettify 모양, 첫 행 `<th>`).
|
|
207
209
|
* HTML 표만 다루는 소비자·채점기용. 기본 false(병합·중첩 없는 표는 GFM 파이프 표) */
|
|
208
210
|
htmlTables?: boolean;
|
|
211
|
+
/** `"gfm"`: 모든 표를 HTML 없이 GFM 파이프 표로 — 세로 병합 칸은 덮인 행마다 같은 값, 가로 병합 칸은 시작 칸에만 값, 셀 안 표는 부모 표 뒤 독립 표로 꺼내고
|
|
212
|
+
* 부모·자식 관계를 `<!-- <table id="t2" parent_id="t1" /> -->` 표지로 남긴다(RAG 색인용). `htmlTables` 와 함께 쓸 수 없다. 기본: 병합·중첩 표는 HTML */
|
|
213
|
+
tableFormat?: "gfm";
|
|
209
214
|
/** 표 오른쪽 끝의 빈 열(서식 문서의 입력란) 보존 (#47).
|
|
210
215
|
* 기본 false: 마크다운 가독성을 위해 후행 빈 열을 트림.
|
|
211
216
|
* 양식 인식 경로(parse_form·fill)는 내부적으로 항상 켠다. */
|
|
@@ -1568,7 +1573,13 @@ declare function applySplices(xml: string, splices: SpliceEdit[]): string;
|
|
|
1568
1573
|
/** 2-pass colSpan/rowSpan 테이블 빌더 및 Markdown 변환 */
|
|
1569
1574
|
|
|
1570
1575
|
declare function flattenLayoutTables(blocks: IRBlock[]): IRBlock[];
|
|
1571
|
-
|
|
1576
|
+
/** blocksToMarkdown 렌더 옵션 */
|
|
1577
|
+
interface MarkdownOptions {
|
|
1578
|
+
/** 표 출력 형식 (`ParseOptions.tableFormat`). "gfm": 모든 표를 HTML 없이 GFM 파이프 표로 — 셀 안 표는 부모 뒤 독립 표로 꺼내고
|
|
1579
|
+
* 부모·자식 관계를 HTML 주석 표지로 남긴다. 기본(미지정)은 병합·중첩 표를 HTML 로 */
|
|
1580
|
+
tableFormat?: "gfm";
|
|
1581
|
+
}
|
|
1582
|
+
declare function blocksToMarkdown(blocks: IRBlock[], options?: MarkdownOptions): string;
|
|
1572
1583
|
/**
|
|
1573
1584
|
* 셀에 GFM 표 문법으로 담을 수 없는 구조 콘텐츠(중첩표·구분선)가 있는가 (#76 Task 4) — hasNestedTables 의 일반화.
|
|
1574
1585
|
* 이미지는 GFM 셀에 `` 로 인라인할 수 있어 여기 세지 않는다 — 대신 GFM 경로가 blocks 를 직접 직렬화해
|
|
@@ -1762,6 +1773,8 @@ interface ChunkOptions {
|
|
|
1762
1773
|
* "block": IRBlock 1개 = 청크 1개
|
|
1763
1774
|
*/
|
|
1764
1775
|
granularity?: "block" | "section";
|
|
1776
|
+
/** 표 출력 형식 — `ParseOptions.tableFormat` 과 같다. "gfm" 이면 표 id 를 문서 전체 순번으로 붙인 뒤 청크마다 렌더한다 */
|
|
1777
|
+
tableFormat?: "gfm";
|
|
1765
1778
|
}
|
|
1766
1779
|
declare function blocksToChunks(blocks: IRBlock[], options?: ChunkOptions): DocChunk[];
|
|
1767
1780
|
|
|
@@ -2340,4 +2353,4 @@ interface FillFormOutput {
|
|
|
2340
2353
|
*/
|
|
2341
2354
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
2342
2355
|
|
|
2343
|
-
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 ClassifyContext, type ClickHereField, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractRegionOptions, type ExtractTableVisualOptions, type ExtractedImage, type ExtractedTable, type ExtractedTableCrop, 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 MuncheLineKind, type MuncheLintFinding, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageBBox, 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 RegionAsset, type RenderAsset, type RenderDocumentOptions, type RenderDocumentResult, type RenderFormat, type RenderObjectType, type RenderRegion, type RenderScene, type RenderSourceFormat, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type ScenePage, type SceneRenderOptions, type SceneRenderResult, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, type TableRepresentation, type TableVisualPolicy, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, chooseTableRepresentation, classifyTable, classifyTableTree, collectTableBlocks, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, extractRenderedRegions, extractTables, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, flattenLayoutTables, formatFillValue, gongmunLintWarnings, hasStructuredCellContent, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, lintMuncheText, markdownToHwpx, markdownToPdf, measureTextWidth, muncheLintWarnings, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parsePptx, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderDocument, renderDocumentToScene, renderHtml, renderHwp5Pages, renderHwpxToSvg, renderSceneToHtml, resolveBuiltinTemplate, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, usesGaejosikMunche, validateHwpx };
|
|
2356
|
+
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 ClassifyContext, type ClickHereField, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractRegionOptions, type ExtractTableVisualOptions, type ExtractedImage, type ExtractedTable, type ExtractedTableCrop, 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 MarkdownOptions, type MarkdownToHwpxOptions, type MeasureOptions, type MuncheLineKind, type MuncheLintFinding, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageBBox, 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 RegionAsset, type RenderAsset, type RenderDocumentOptions, type RenderDocumentResult, type RenderFormat, type RenderObjectType, type RenderRegion, type RenderScene, type RenderSourceFormat, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type ScenePage, type SceneRenderOptions, type SceneRenderResult, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, type TableRepresentation, type TableVisualPolicy, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPages, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, chooseTableRepresentation, classifyTable, classifyTableTree, collectTableBlocks, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractClickHereFields, extractFormFields, extractFormSchema, extractRenderedRegions, extractTables, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, flattenLayoutTables, formatFillValue, gongmunLintWarnings, hasStructuredCellContent, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, lintMuncheText, markdownToHwpx, markdownToPdf, measureTextWidth, muncheLintWarnings, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parsePptx, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, readBuiltinTemplate, readBuiltinTemplateSample, redactMarkdown, redactText, renderDocument, renderDocumentToScene, renderHtml, renderHwp5Pages, renderHwpxToSvg, renderSceneToHtml, resolveBuiltinTemplate, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, usesGaejosikMunche, validateHwpx };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
blocksToPages,
|
|
3
3
|
inlineImagesIntoMarkdown
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DQHDI567.js";
|
|
5
5
|
import {
|
|
6
6
|
parsePageRange
|
|
7
7
|
} from "./chunk-V4BH5SRQ.js";
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
MAX_COLS,
|
|
14
14
|
MAX_ROWS,
|
|
15
15
|
MAX_TABLE_CELLS,
|
|
16
|
+
assignTableIds,
|
|
16
17
|
blocksToMarkdown,
|
|
17
18
|
buildTable,
|
|
18
19
|
convertTableToText,
|
|
@@ -31,7 +32,7 @@ import {
|
|
|
31
32
|
tidyScriptTags,
|
|
32
33
|
unframeLayoutTables,
|
|
33
34
|
wrapScript
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-YLST4S4P.js";
|
|
35
36
|
import {
|
|
36
37
|
KordocError,
|
|
37
38
|
OPTIONAL_DEP_INSTALL_HINT,
|
|
@@ -49,7 +50,7 @@ import {
|
|
|
49
50
|
toArrayBuffer,
|
|
50
51
|
unescapeHtml,
|
|
51
52
|
unzipLimitBytes
|
|
52
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-Z2WI3E4N.js";
|
|
53
54
|
|
|
54
55
|
// src/plain-markdown.ts
|
|
55
56
|
function toPlainMarkdown(md2) {
|
|
@@ -3667,7 +3668,7 @@ import JSZip2 from "jszip";
|
|
|
3667
3668
|
|
|
3668
3669
|
// src/hwpx/zip-sections.ts
|
|
3669
3670
|
import { inflateRawSync as inflateRawSync3 } from "zlib";
|
|
3670
|
-
function extractFromBrokenZip(buffer) {
|
|
3671
|
+
function extractFromBrokenZip(buffer, options) {
|
|
3671
3672
|
const data = new Uint8Array(buffer);
|
|
3672
3673
|
const view = new DataView(buffer);
|
|
3673
3674
|
let pos = 0;
|
|
@@ -3734,7 +3735,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3734
3735
|
}
|
|
3735
3736
|
if (blocks.length === 0) throw new KordocError("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3736
3737
|
applyPageText(blocks, shared);
|
|
3737
|
-
const markdown = blocksToMarkdown(blocks);
|
|
3738
|
+
const markdown = blocksToMarkdown(blocks, { tableFormat: options?.tableFormat });
|
|
3738
3739
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3739
3740
|
}
|
|
3740
3741
|
async function readKordocLayout(zip) {
|
|
@@ -3895,7 +3896,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3895
3896
|
try {
|
|
3896
3897
|
zip = await JSZip3.loadAsync(buffer);
|
|
3897
3898
|
} catch {
|
|
3898
|
-
return extractFromBrokenZip(buffer);
|
|
3899
|
+
return extractFromBrokenZip(buffer, options);
|
|
3899
3900
|
}
|
|
3900
3901
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3901
3902
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
@@ -3977,7 +3978,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3977
3978
|
const shown = options?.layoutTables === "keep" ? blocks : unframeLayoutTables(blocks, !!options?.keepTrailingEmptyCols);
|
|
3978
3979
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
3979
3980
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3980
|
-
const markdown = blocksToMarkdown(shown);
|
|
3981
|
+
const markdown = blocksToMarkdown(shown, { tableFormat: options?.tableFormat });
|
|
3981
3982
|
return { markdown, blocks: shown, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3982
3983
|
}
|
|
3983
3984
|
|
|
@@ -6097,7 +6098,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6097
6098
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6098
6099
|
}
|
|
6099
6100
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6100
|
-
let markdown = blocksToMarkdown(flatBlocks);
|
|
6101
|
+
let markdown = blocksToMarkdown(flatBlocks, { tableFormat: options?.tableFormat });
|
|
6101
6102
|
if (options?.inlineImages && options.images !== false && images.length > 0) {
|
|
6102
6103
|
try {
|
|
6103
6104
|
markdown = inlineImagesIntoMarkdown(markdown, images, { compress: true });
|
|
@@ -18982,7 +18983,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
18982
18983
|
version: "3.0"
|
|
18983
18984
|
};
|
|
18984
18985
|
return {
|
|
18985
|
-
markdown: blocksToMarkdown(blocks),
|
|
18986
|
+
markdown: blocksToMarkdown(blocks, { tableFormat: options?.tableFormat }),
|
|
18986
18987
|
blocks,
|
|
18987
18988
|
metadata,
|
|
18988
18989
|
warnings: warnings.length ? warnings : void 0
|
|
@@ -19724,7 +19725,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19724
19725
|
} catch {
|
|
19725
19726
|
}
|
|
19726
19727
|
}
|
|
19727
|
-
const markdown = blocksToMarkdown(blocks);
|
|
19728
|
+
const markdown = blocksToMarkdown(blocks, { tableFormat: options?.tableFormat });
|
|
19728
19729
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19729
19730
|
}
|
|
19730
19731
|
|
|
@@ -20332,7 +20333,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20332
20333
|
pageCount: totalSheets
|
|
20333
20334
|
};
|
|
20334
20335
|
return {
|
|
20335
|
-
markdown: blocksToMarkdown(allBlocks),
|
|
20336
|
+
markdown: blocksToMarkdown(allBlocks, { tableFormat: options?.tableFormat }),
|
|
20336
20337
|
blocks: allBlocks,
|
|
20337
20338
|
metadata,
|
|
20338
20339
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -21496,7 +21497,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21496
21497
|
}
|
|
21497
21498
|
}
|
|
21498
21499
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: b.level ?? 2, text: b.text ?? "" }));
|
|
21499
|
-
const markdown = blocksToMarkdown(blocks);
|
|
21500
|
+
const markdown = blocksToMarkdown(blocks, { tableFormat: options?.tableFormat });
|
|
21500
21501
|
return {
|
|
21501
21502
|
markdown,
|
|
21502
21503
|
blocks,
|
|
@@ -21818,7 +21819,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21818
21819
|
}
|
|
21819
21820
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: b.level ?? 2, text: b.text ?? "", pageNumber: b.pageNumber }));
|
|
21820
21821
|
return {
|
|
21821
|
-
markdown: blocksToMarkdown(blocks),
|
|
21822
|
+
markdown: blocksToMarkdown(blocks, { tableFormat: options?.tableFormat }),
|
|
21822
21823
|
blocks,
|
|
21823
21824
|
metadata,
|
|
21824
21825
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -21878,7 +21879,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
21878
21879
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, options?.keepTrailingEmptyCols ?? false);
|
|
21879
21880
|
}
|
|
21880
21881
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: b.level ?? 1, text: b.text, pageNumber: b.pageNumber }));
|
|
21881
|
-
const markdown = blocksToMarkdown(blocks);
|
|
21882
|
+
const markdown = blocksToMarkdown(blocks, { tableFormat: options?.tableFormat });
|
|
21882
21883
|
return {
|
|
21883
21884
|
markdown,
|
|
21884
21885
|
blocks,
|
|
@@ -38603,6 +38604,8 @@ function sameBreadcrumb(a, b) {
|
|
|
38603
38604
|
function blocksToChunks(blocks, options) {
|
|
38604
38605
|
const granularity = options?.granularity ?? "section";
|
|
38605
38606
|
const includeCells = options?.includeTableCells ?? false;
|
|
38607
|
+
const mdOptions = { tableFormat: options?.tableFormat };
|
|
38608
|
+
if (options?.tableFormat === "gfm") assignTableIds(blocks);
|
|
38606
38609
|
const chunks = [];
|
|
38607
38610
|
const headingStack = [];
|
|
38608
38611
|
const listStack = [];
|
|
@@ -38616,12 +38619,12 @@ function blocksToChunks(blocks, options) {
|
|
|
38616
38619
|
let run = null;
|
|
38617
38620
|
const flushRun = () => {
|
|
38618
38621
|
if (!run) return;
|
|
38619
|
-
push("text", run.breadcrumb, blocksToMarkdown(run.blocks), [run.start, run.end], run.page);
|
|
38622
|
+
push("text", run.breadcrumb, blocksToMarkdown(run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
38620
38623
|
run = null;
|
|
38621
38624
|
};
|
|
38622
38625
|
for (let i = 0; i < blocks.length; i++) {
|
|
38623
38626
|
const block = blocks[i];
|
|
38624
|
-
const md2 = blocksToMarkdown([block]);
|
|
38627
|
+
const md2 = blocksToMarkdown([block], mdOptions);
|
|
38625
38628
|
if (!md2) continue;
|
|
38626
38629
|
if (block.type === "heading") {
|
|
38627
38630
|
flushRun();
|
|
@@ -41553,6 +41556,9 @@ async function extractTables(input, options = {}) {
|
|
|
41553
41556
|
async function parse(input, options) {
|
|
41554
41557
|
let buffer;
|
|
41555
41558
|
const opts = typeof input === "string" && !options?.filePath ? { ...options, filePath: input } : options;
|
|
41559
|
+
if (opts?.htmlTables && opts.tableFormat) {
|
|
41560
|
+
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
41561
|
+
}
|
|
41556
41562
|
if (typeof input === "string") {
|
|
41557
41563
|
try {
|
|
41558
41564
|
const buf = await readFile3(input);
|
|
@@ -41581,7 +41587,7 @@ async function parse(input, options) {
|
|
|
41581
41587
|
out = { ...result, warnings: [...result.warnings ?? [], { code: "PARTIAL_PARSE", message: `\uC694\uCCAD\uD55C \uCABD \uBC94\uC704(${opts.pages})\uAC00 \uBB38\uC11C \uCABD(1~${result.pageCount})\uACFC \uACB9\uCE58\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4` }] };
|
|
41582
41588
|
}
|
|
41583
41589
|
if (out.success && !out.pages) {
|
|
41584
|
-
const pages = blocksToPages(out.blocks);
|
|
41590
|
+
const pages = blocksToPages(out.blocks, (bs) => blocksToMarkdown(bs, { tableFormat: opts?.tableFormat }));
|
|
41585
41591
|
if (pages) out = { ...out, pages };
|
|
41586
41592
|
}
|
|
41587
41593
|
if (out.success && opts?.plain) {
|
|
@@ -41634,13 +41640,13 @@ function scriptsOff(r, off) {
|
|
|
41634
41640
|
}
|
|
41635
41641
|
async function parseImage(buffer, options) {
|
|
41636
41642
|
try {
|
|
41637
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
41643
|
+
const { parseImageDocument } = await import("./image-ocr-I52GBXRE.js");
|
|
41638
41644
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
41639
41645
|
stripScriptTags({ blocks });
|
|
41640
41646
|
return {
|
|
41641
41647
|
success: true,
|
|
41642
41648
|
fileType: "image",
|
|
41643
|
-
markdown: blocksToMarkdown(blocks),
|
|
41649
|
+
markdown: blocksToMarkdown(blocks, { tableFormat: options?.tableFormat }),
|
|
41644
41650
|
blocks,
|
|
41645
41651
|
warnings: warnings.length ? warnings : void 0,
|
|
41646
41652
|
pageCount: 1
|
|
@@ -41694,7 +41700,7 @@ async function parseHwp(buffer, options) {
|
|
|
41694
41700
|
async function parsePdf(buffer, options) {
|
|
41695
41701
|
let parsePdfDocument;
|
|
41696
41702
|
try {
|
|
41697
|
-
const mod = await import("./parser-
|
|
41703
|
+
const mod = await import("./parser-YX4LGKIK.js");
|
|
41698
41704
|
parsePdfDocument = mod.parsePdfDocument;
|
|
41699
41705
|
} catch {
|
|
41700
41706
|
return {
|