kordoc 3.16.2 → 3.18.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 +37 -12
- package/dist/{-C4FVXHIP.js → -OUCPI6B3.js} +9 -7
- package/dist/{chunk-HECUYZZK.js → chunk-4YEZTZAR.js} +79 -3
- package/dist/chunk-4YEZTZAR.js.map +1 -0
- package/dist/{chunk-72LLOLFX.cjs → chunk-5HDBLRVP.cjs} +45 -9
- package/dist/chunk-5HDBLRVP.cjs.map +1 -0
- package/dist/{chunk-4WI7QXEG.js → chunk-6Y4KKPC3.js} +2 -2
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-EJ2ZIYTO.js → chunk-GIXXV52X.js} +39 -3
- package/dist/chunk-GIXXV52X.js.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-EUEKDZ7O.js → chunk-PWHM3KAA.js} +535 -83
- package/dist/chunk-PWHM3KAA.js.map +1 -0
- package/dist/{chunk-WR5LHRXO.js → chunk-VP34RO24.js} +3 -3
- package/dist/{chunk-IS3IK7UT.js → chunk-YWIYGXLI.js} +39 -3
- package/dist/chunk-YWIYGXLI.js.map +1 -0
- package/dist/{chunk-E4Y73XRH.js → chunk-ZTUQYITH.js} +127 -68
- package/dist/chunk-ZTUQYITH.js.map +1 -0
- package/dist/cli.js +18 -15
- package/dist/cli.js.map +1 -1
- package/dist/formula-5NKVS2LR.cjs.map +1 -1
- package/dist/index.cjs +1045 -459
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -3
- package/dist/index.d.ts +121 -3
- package/dist/index.js +784 -198
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -10
- package/dist/mcp.js.map +1 -1
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-GWL72XYS.js → parser-5D6BQYTX.js} +2 -2
- package/dist/{parser-CMPNM6ZL.js → parser-NZAE7PBE.js} +3 -3
- package/dist/{parser-YVRTKGKO.cjs → parser-S34YR2SH.cjs} +14 -14
- package/dist/parser-S34YR2SH.cjs.map +1 -0
- package/dist/provider-G4C2V2PD.cjs.map +1 -1
- package/dist/render-HRAW7ASR.js +10 -0
- package/dist/seal-CK64CXWO.js +10 -0
- package/dist/{watch-WLI6K3IR.js → watch-2EFXBRYK.js} +7 -7
- package/package.json +1 -1
- package/dist/chunk-72LLOLFX.cjs.map +0 -1
- package/dist/chunk-E4Y73XRH.js.map +0 -1
- package/dist/chunk-EJ2ZIYTO.js.map +0 -1
- package/dist/chunk-EUEKDZ7O.js.map +0 -1
- package/dist/chunk-HECUYZZK.js.map +0 -1
- package/dist/chunk-IS3IK7UT.js.map +0 -1
- package/dist/parser-YVRTKGKO.cjs.map +0 -1
- package/dist/render-A2LFMJCP.js +0 -10
- package/dist/seal-KA4VAV2Z.js +0 -10
- /package/dist/{-C4FVXHIP.js.map → -OUCPI6B3.js.map} +0 -0
- /package/dist/{chunk-4WI7QXEG.js.map → chunk-6Y4KKPC3.js.map} +0 -0
- /package/dist/{chunk-WR5LHRXO.js.map → chunk-VP34RO24.js.map} +0 -0
- /package/dist/{parser-GWL72XYS.js.map → parser-5D6BQYTX.js.map} +0 -0
- /package/dist/{parser-CMPNM6ZL.js.map → parser-NZAE7PBE.js.map} +0 -0
- /package/dist/{render-A2LFMJCP.js.map → render-HRAW7ASR.js.map} +0 -0
- /package/dist/{seal-KA4VAV2Z.js.map → seal-CK64CXWO.js.map} +0 -0
- /package/dist/{watch-WLI6K3IR.js.map → watch-2EFXBRYK.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -133,6 +133,25 @@ interface ParseOptions {
|
|
|
133
133
|
* `~/.cache/kordoc/models/pix2text/` 에 SHA-256 검증과 함께 저장된다.
|
|
134
134
|
*/
|
|
135
135
|
formulaOcr?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* 레이아웃 표 페이지 반복 헤더(러닝 헤더) 정리 휴리스틱 활성화 (기본 false).
|
|
138
|
+
*
|
|
139
|
+
* 구형 HWP5 문서가 페이지마다 재삽입한 짧은 번호매김 러닝 헤더
|
|
140
|
+
* ("2. 과제 구축 내용")를 최초 1회만 남기고 이후 중복을 제거한다.
|
|
141
|
+
* 다만 페이지 위치 정보가 없는 HWP5 특성상 이 휴리스틱은 정당하게 반복되는
|
|
142
|
+
* 번호매김 문단(예: 붙임/별지별 재번호 "1. 목적")도 삭제할 수 있어 opt-in 으로
|
|
143
|
+
* 둔다. 활성 시 제거가 발생하면 HIDDEN_TEXT_FILTERED 경고를 남긴다.
|
|
144
|
+
*/
|
|
145
|
+
dedupeRunningHeaders?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* 추출된 이미지를 마크다운에 base64 data URI 로 인라인 (기본 false).
|
|
148
|
+
*
|
|
149
|
+
* 활성화 시 `` 참조를 `` 로
|
|
150
|
+
* 치환한다. 임베드된 BMP 는 PNG 로 무손실 압축 후 인라인하여 용량을 크게 줄인다.
|
|
151
|
+
* 별도 이미지 파일 없이 자체 완결형 마크다운이 되어 MCP/AI 에이전트 소비에 적합하다.
|
|
152
|
+
* (현재 HWP5 경로 지원)
|
|
153
|
+
*/
|
|
154
|
+
inlineImages?: boolean;
|
|
136
155
|
}
|
|
137
156
|
/** 파싱 중 스킵/실패한 요소 보고 */
|
|
138
157
|
interface ParseWarning {
|
|
@@ -633,6 +652,79 @@ interface HwpxTheme {
|
|
|
633
652
|
tableHeaderBold?: boolean;
|
|
634
653
|
}
|
|
635
654
|
|
|
655
|
+
/**
|
|
656
|
+
* 서식 프로필(Format Profile) — generate 시각 서식 재현 (이슈 #41 / PR #42).
|
|
657
|
+
*
|
|
658
|
+
* markdownToHwpx가 표의 위상(병합 구조)뿐 아니라 음영·괘선·열 너비·셀 글꼴까지
|
|
659
|
+
* 재현할 수 있도록, 원본 문서 없이 서식만 실어 나르는 프로필의 타입·리맵·XML 빌더.
|
|
660
|
+
*
|
|
661
|
+
* 파서 IR(IRCell/IRTable)에는 서식 필드가 없으므로 프로필은 IR과 독립된 통로다.
|
|
662
|
+
* 프로필의 borderFill/charPr id는 표별 로컬 네임스페이스라, 여기서 문서 전역 id로
|
|
663
|
+
* 재할당(remap)한 뒤 header에 정의를 등록하고 셀에 연결한다.
|
|
664
|
+
*/
|
|
665
|
+
/** 한 변의 괘선 정의 */
|
|
666
|
+
interface BorderDef {
|
|
667
|
+
/** SOLID | NONE | DASH | DOT ... (HWPX border type) */
|
|
668
|
+
type: string;
|
|
669
|
+
/** "0.12 mm" 등 HWPX width 문자열 */
|
|
670
|
+
width: string;
|
|
671
|
+
/** "#RRGGBB" */
|
|
672
|
+
color: string;
|
|
673
|
+
}
|
|
674
|
+
/** 셀 테두리+음영 정의 (표별 로컬 id로 참조됨) */
|
|
675
|
+
interface BorderFillDef {
|
|
676
|
+
leftBorder?: BorderDef;
|
|
677
|
+
rightBorder?: BorderDef;
|
|
678
|
+
topBorder?: BorderDef;
|
|
679
|
+
bottomBorder?: BorderDef;
|
|
680
|
+
/** 셀 음영 — winBrush faceColor. 채움 없으면 생략 */
|
|
681
|
+
fill?: {
|
|
682
|
+
faceColor: string;
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
/** 셀 글꼴 정의 (표별 로컬 id로 참조됨) */
|
|
686
|
+
interface CharPrDef {
|
|
687
|
+
/** "1100" (= 11pt × 100) */
|
|
688
|
+
height_hwpunit?: string;
|
|
689
|
+
textColor?: string;
|
|
690
|
+
bold?: boolean;
|
|
691
|
+
italic?: boolean;
|
|
692
|
+
underline?: boolean;
|
|
693
|
+
/** fontfaces HANGUL 순번. render는 이름표로 손실하므로 원본 순번 보존용 */
|
|
694
|
+
fontRef_hangul?: string;
|
|
695
|
+
}
|
|
696
|
+
/** 셀 하나의 서식 참조 (좌표 = 병합 셀 좌상단 앵커) */
|
|
697
|
+
interface CellProfile {
|
|
698
|
+
row: number;
|
|
699
|
+
col: number;
|
|
700
|
+
rowSpan?: number;
|
|
701
|
+
colSpan?: number;
|
|
702
|
+
width_hwpunit?: string;
|
|
703
|
+
height_hwpunit?: string;
|
|
704
|
+
/** used_border_fills 키 */
|
|
705
|
+
borderFillIDRef?: string;
|
|
706
|
+
/** used_char_prs 키 */
|
|
707
|
+
charPrIDRef?: string;
|
|
708
|
+
}
|
|
709
|
+
/** 표 하나의 서식 프로필 */
|
|
710
|
+
interface TableProfile {
|
|
711
|
+
/** 문서 내 표 등장 순서 (0-기준) */
|
|
712
|
+
table_index: number;
|
|
713
|
+
rows: number;
|
|
714
|
+
cols: number;
|
|
715
|
+
width_hwpunit?: string;
|
|
716
|
+
col_widths_hwpunit?: string[];
|
|
717
|
+
cells: CellProfile[];
|
|
718
|
+
/** 로컬 id → 정의. 표별 독립 네임스페이스 */
|
|
719
|
+
used_border_fills: Record<string, BorderFillDef>;
|
|
720
|
+
used_char_prs?: Record<string, CharPrDef>;
|
|
721
|
+
}
|
|
722
|
+
/** 문서 전체 서식 프로필 */
|
|
723
|
+
interface FormatProfile {
|
|
724
|
+
schema_version?: string;
|
|
725
|
+
tables: TableProfile[];
|
|
726
|
+
}
|
|
727
|
+
|
|
636
728
|
/**
|
|
637
729
|
* Markdown → HWPX 역변환
|
|
638
730
|
*
|
|
@@ -658,12 +750,37 @@ interface MarkdownToHwpxOptions {
|
|
|
658
750
|
* 미지정 시 기존 범용 마크다운 변환 동작 그대로 유지.
|
|
659
751
|
*/
|
|
660
752
|
gongmun?: GongmunOptions;
|
|
753
|
+
/**
|
|
754
|
+
* 서식 프로필 — 표의 borderFill(테두리·음영)·열 너비·셀 글꼴을 원본 문서 없이
|
|
755
|
+
* 재현한다(이슈 #41). `hwpxToProfile()`로 추출하거나 직접 작성한 프로필을 넘기면,
|
|
756
|
+
* 문서 내 표 등장 순서(table_index)로 매칭해 셀 좌표별 서식을 적용한다.
|
|
757
|
+
* 미지정 시 기존 기본 서식(단일 SOLID 테두리·균등 열폭) 그대로.
|
|
758
|
+
*/
|
|
759
|
+
profile?: FormatProfile;
|
|
661
760
|
}
|
|
662
761
|
/**
|
|
663
762
|
* 마크다운 텍스트를 HWPX (ArrayBuffer)로 변환.
|
|
664
763
|
*/
|
|
665
764
|
declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOptions): Promise<ArrayBuffer>;
|
|
666
765
|
|
|
766
|
+
/**
|
|
767
|
+
* 서식 프로필 추출 (hwpx → FormatProfile) — 이슈 #41 / PR #42 Part B.
|
|
768
|
+
*
|
|
769
|
+
* 원본 hwpx에서 표의 borderFill(테두리·음영)·열너비·셀 글꼴을 읽어
|
|
770
|
+
* FormatProfile JSON으로 뽑는다. 이 프로필을 `markdownToHwpx(md, { profile })`에
|
|
771
|
+
* 넘기면 원본 없이 같은 시각 서식을 재현한다(진짜 라운드트립).
|
|
772
|
+
*
|
|
773
|
+
* render 경로(head-styles/svg-render)는 mm→pt·font→family 손실 변환이라
|
|
774
|
+
* 프로필 충실 추출엔 부적합. 여기서는 header/section XML을 원문 그대로 읽는
|
|
775
|
+
* 얇은 전용 파서를 쓴다.
|
|
776
|
+
*/
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* hwpx → FormatProfile. 문서 내 top-level 표를 등장 순서대로 추출한다.
|
|
780
|
+
* @param input hwpx ArrayBuffer 또는 Buffer
|
|
781
|
+
*/
|
|
782
|
+
declare function hwpxToProfile(input: ArrayBuffer | Buffer): Promise<FormatProfile>;
|
|
783
|
+
|
|
667
784
|
/**
|
|
668
785
|
* 한글 조판 텍스트 폭 계산 — 함초롬바탕(HCR Batang) 실측 advance 테이블
|
|
669
786
|
*
|
|
@@ -1120,8 +1237,9 @@ interface RenderSvgResult {
|
|
|
1120
1237
|
};
|
|
1121
1238
|
}
|
|
1122
1239
|
/**
|
|
1123
|
-
* HWPX(한컴 저장본) → 레이아웃 보존 SVG (
|
|
1124
|
-
* 조판 캐시(linesegarray)가 없는
|
|
1240
|
+
* HWPX(한컴 저장본) → 레이아웃 보존 SVG. **전 구역(section*)을 세로 스택으로** 렌더한다.
|
|
1241
|
+
* 조판 캐시(linesegarray)가 없는 구역은 reflow 옵션으로 합성 조판(없으면 그 구역 생략);
|
|
1242
|
+
* 렌더 가능한 구역이 하나도 없으면 KordocError.
|
|
1125
1243
|
*/
|
|
1126
1244
|
declare function renderHwpxToSvg(input: ArrayBuffer | Uint8Array, options?: RenderSvgOptions): Promise<RenderSvgResult>;
|
|
1127
1245
|
|
|
@@ -1225,4 +1343,4 @@ interface FillFormOutput {
|
|
|
1225
1343
|
*/
|
|
1226
1344
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
1227
1345
|
|
|
1228
|
-
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 FillInput, 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 PlaceSealResult, type PrintOptions, type PrintPreset, 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, VERSION, type ValidateIssue, type ValidateResult, 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, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, validateHwpx };
|
|
1346
|
+
export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type DiffChangeType, type DiffResult, 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 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 PlaceSealResult, type PrintOptions, type PrintPreset, 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, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, hwpxToProfile, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, validateHwpx };
|
package/dist/index.d.ts
CHANGED
|
@@ -133,6 +133,25 @@ interface ParseOptions {
|
|
|
133
133
|
* `~/.cache/kordoc/models/pix2text/` 에 SHA-256 검증과 함께 저장된다.
|
|
134
134
|
*/
|
|
135
135
|
formulaOcr?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* 레이아웃 표 페이지 반복 헤더(러닝 헤더) 정리 휴리스틱 활성화 (기본 false).
|
|
138
|
+
*
|
|
139
|
+
* 구형 HWP5 문서가 페이지마다 재삽입한 짧은 번호매김 러닝 헤더
|
|
140
|
+
* ("2. 과제 구축 내용")를 최초 1회만 남기고 이후 중복을 제거한다.
|
|
141
|
+
* 다만 페이지 위치 정보가 없는 HWP5 특성상 이 휴리스틱은 정당하게 반복되는
|
|
142
|
+
* 번호매김 문단(예: 붙임/별지별 재번호 "1. 목적")도 삭제할 수 있어 opt-in 으로
|
|
143
|
+
* 둔다. 활성 시 제거가 발생하면 HIDDEN_TEXT_FILTERED 경고를 남긴다.
|
|
144
|
+
*/
|
|
145
|
+
dedupeRunningHeaders?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* 추출된 이미지를 마크다운에 base64 data URI 로 인라인 (기본 false).
|
|
148
|
+
*
|
|
149
|
+
* 활성화 시 `` 참조를 `` 로
|
|
150
|
+
* 치환한다. 임베드된 BMP 는 PNG 로 무손실 압축 후 인라인하여 용량을 크게 줄인다.
|
|
151
|
+
* 별도 이미지 파일 없이 자체 완결형 마크다운이 되어 MCP/AI 에이전트 소비에 적합하다.
|
|
152
|
+
* (현재 HWP5 경로 지원)
|
|
153
|
+
*/
|
|
154
|
+
inlineImages?: boolean;
|
|
136
155
|
}
|
|
137
156
|
/** 파싱 중 스킵/실패한 요소 보고 */
|
|
138
157
|
interface ParseWarning {
|
|
@@ -633,6 +652,79 @@ interface HwpxTheme {
|
|
|
633
652
|
tableHeaderBold?: boolean;
|
|
634
653
|
}
|
|
635
654
|
|
|
655
|
+
/**
|
|
656
|
+
* 서식 프로필(Format Profile) — generate 시각 서식 재현 (이슈 #41 / PR #42).
|
|
657
|
+
*
|
|
658
|
+
* markdownToHwpx가 표의 위상(병합 구조)뿐 아니라 음영·괘선·열 너비·셀 글꼴까지
|
|
659
|
+
* 재현할 수 있도록, 원본 문서 없이 서식만 실어 나르는 프로필의 타입·리맵·XML 빌더.
|
|
660
|
+
*
|
|
661
|
+
* 파서 IR(IRCell/IRTable)에는 서식 필드가 없으므로 프로필은 IR과 독립된 통로다.
|
|
662
|
+
* 프로필의 borderFill/charPr id는 표별 로컬 네임스페이스라, 여기서 문서 전역 id로
|
|
663
|
+
* 재할당(remap)한 뒤 header에 정의를 등록하고 셀에 연결한다.
|
|
664
|
+
*/
|
|
665
|
+
/** 한 변의 괘선 정의 */
|
|
666
|
+
interface BorderDef {
|
|
667
|
+
/** SOLID | NONE | DASH | DOT ... (HWPX border type) */
|
|
668
|
+
type: string;
|
|
669
|
+
/** "0.12 mm" 등 HWPX width 문자열 */
|
|
670
|
+
width: string;
|
|
671
|
+
/** "#RRGGBB" */
|
|
672
|
+
color: string;
|
|
673
|
+
}
|
|
674
|
+
/** 셀 테두리+음영 정의 (표별 로컬 id로 참조됨) */
|
|
675
|
+
interface BorderFillDef {
|
|
676
|
+
leftBorder?: BorderDef;
|
|
677
|
+
rightBorder?: BorderDef;
|
|
678
|
+
topBorder?: BorderDef;
|
|
679
|
+
bottomBorder?: BorderDef;
|
|
680
|
+
/** 셀 음영 — winBrush faceColor. 채움 없으면 생략 */
|
|
681
|
+
fill?: {
|
|
682
|
+
faceColor: string;
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
/** 셀 글꼴 정의 (표별 로컬 id로 참조됨) */
|
|
686
|
+
interface CharPrDef {
|
|
687
|
+
/** "1100" (= 11pt × 100) */
|
|
688
|
+
height_hwpunit?: string;
|
|
689
|
+
textColor?: string;
|
|
690
|
+
bold?: boolean;
|
|
691
|
+
italic?: boolean;
|
|
692
|
+
underline?: boolean;
|
|
693
|
+
/** fontfaces HANGUL 순번. render는 이름표로 손실하므로 원본 순번 보존용 */
|
|
694
|
+
fontRef_hangul?: string;
|
|
695
|
+
}
|
|
696
|
+
/** 셀 하나의 서식 참조 (좌표 = 병합 셀 좌상단 앵커) */
|
|
697
|
+
interface CellProfile {
|
|
698
|
+
row: number;
|
|
699
|
+
col: number;
|
|
700
|
+
rowSpan?: number;
|
|
701
|
+
colSpan?: number;
|
|
702
|
+
width_hwpunit?: string;
|
|
703
|
+
height_hwpunit?: string;
|
|
704
|
+
/** used_border_fills 키 */
|
|
705
|
+
borderFillIDRef?: string;
|
|
706
|
+
/** used_char_prs 키 */
|
|
707
|
+
charPrIDRef?: string;
|
|
708
|
+
}
|
|
709
|
+
/** 표 하나의 서식 프로필 */
|
|
710
|
+
interface TableProfile {
|
|
711
|
+
/** 문서 내 표 등장 순서 (0-기준) */
|
|
712
|
+
table_index: number;
|
|
713
|
+
rows: number;
|
|
714
|
+
cols: number;
|
|
715
|
+
width_hwpunit?: string;
|
|
716
|
+
col_widths_hwpunit?: string[];
|
|
717
|
+
cells: CellProfile[];
|
|
718
|
+
/** 로컬 id → 정의. 표별 독립 네임스페이스 */
|
|
719
|
+
used_border_fills: Record<string, BorderFillDef>;
|
|
720
|
+
used_char_prs?: Record<string, CharPrDef>;
|
|
721
|
+
}
|
|
722
|
+
/** 문서 전체 서식 프로필 */
|
|
723
|
+
interface FormatProfile {
|
|
724
|
+
schema_version?: string;
|
|
725
|
+
tables: TableProfile[];
|
|
726
|
+
}
|
|
727
|
+
|
|
636
728
|
/**
|
|
637
729
|
* Markdown → HWPX 역변환
|
|
638
730
|
*
|
|
@@ -658,12 +750,37 @@ interface MarkdownToHwpxOptions {
|
|
|
658
750
|
* 미지정 시 기존 범용 마크다운 변환 동작 그대로 유지.
|
|
659
751
|
*/
|
|
660
752
|
gongmun?: GongmunOptions;
|
|
753
|
+
/**
|
|
754
|
+
* 서식 프로필 — 표의 borderFill(테두리·음영)·열 너비·셀 글꼴을 원본 문서 없이
|
|
755
|
+
* 재현한다(이슈 #41). `hwpxToProfile()`로 추출하거나 직접 작성한 프로필을 넘기면,
|
|
756
|
+
* 문서 내 표 등장 순서(table_index)로 매칭해 셀 좌표별 서식을 적용한다.
|
|
757
|
+
* 미지정 시 기존 기본 서식(단일 SOLID 테두리·균등 열폭) 그대로.
|
|
758
|
+
*/
|
|
759
|
+
profile?: FormatProfile;
|
|
661
760
|
}
|
|
662
761
|
/**
|
|
663
762
|
* 마크다운 텍스트를 HWPX (ArrayBuffer)로 변환.
|
|
664
763
|
*/
|
|
665
764
|
declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOptions): Promise<ArrayBuffer>;
|
|
666
765
|
|
|
766
|
+
/**
|
|
767
|
+
* 서식 프로필 추출 (hwpx → FormatProfile) — 이슈 #41 / PR #42 Part B.
|
|
768
|
+
*
|
|
769
|
+
* 원본 hwpx에서 표의 borderFill(테두리·음영)·열너비·셀 글꼴을 읽어
|
|
770
|
+
* FormatProfile JSON으로 뽑는다. 이 프로필을 `markdownToHwpx(md, { profile })`에
|
|
771
|
+
* 넘기면 원본 없이 같은 시각 서식을 재현한다(진짜 라운드트립).
|
|
772
|
+
*
|
|
773
|
+
* render 경로(head-styles/svg-render)는 mm→pt·font→family 손실 변환이라
|
|
774
|
+
* 프로필 충실 추출엔 부적합. 여기서는 header/section XML을 원문 그대로 읽는
|
|
775
|
+
* 얇은 전용 파서를 쓴다.
|
|
776
|
+
*/
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* hwpx → FormatProfile. 문서 내 top-level 표를 등장 순서대로 추출한다.
|
|
780
|
+
* @param input hwpx ArrayBuffer 또는 Buffer
|
|
781
|
+
*/
|
|
782
|
+
declare function hwpxToProfile(input: ArrayBuffer | Buffer): Promise<FormatProfile>;
|
|
783
|
+
|
|
667
784
|
/**
|
|
668
785
|
* 한글 조판 텍스트 폭 계산 — 함초롬바탕(HCR Batang) 실측 advance 테이블
|
|
669
786
|
*
|
|
@@ -1120,8 +1237,9 @@ interface RenderSvgResult {
|
|
|
1120
1237
|
};
|
|
1121
1238
|
}
|
|
1122
1239
|
/**
|
|
1123
|
-
* HWPX(한컴 저장본) → 레이아웃 보존 SVG (
|
|
1124
|
-
* 조판 캐시(linesegarray)가 없는
|
|
1240
|
+
* HWPX(한컴 저장본) → 레이아웃 보존 SVG. **전 구역(section*)을 세로 스택으로** 렌더한다.
|
|
1241
|
+
* 조판 캐시(linesegarray)가 없는 구역은 reflow 옵션으로 합성 조판(없으면 그 구역 생략);
|
|
1242
|
+
* 렌더 가능한 구역이 하나도 없으면 KordocError.
|
|
1125
1243
|
*/
|
|
1126
1244
|
declare function renderHwpxToSvg(input: ArrayBuffer | Uint8Array, options?: RenderSvgOptions): Promise<RenderSvgResult>;
|
|
1127
1245
|
|
|
@@ -1225,4 +1343,4 @@ interface FillFormOutput {
|
|
|
1225
1343
|
*/
|
|
1226
1344
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
1227
1345
|
|
|
1228
|
-
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 FillInput, 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 PlaceSealResult, type PrintOptions, type PrintPreset, 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, VERSION, type ValidateIssue, type ValidateResult, 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, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, validateHwpx };
|
|
1346
|
+
export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type DiffChangeType, type DiffResult, 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 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 PlaceSealResult, type PrintOptions, type PrintPreset, 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, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, hwpxToProfile, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, validateHwpx };
|