kordoc 3.18.1 → 4.0.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.
Files changed (78) hide show
  1. package/README.md +768 -752
  2. package/dist/{-V66QW3WA.js → -O3AWNVPH.js} +16 -8
  3. package/dist/{chunk-2IBFK5ZO.js → chunk-33OUI7HC.js} +2 -2
  4. package/dist/chunk-33OUI7HC.js.map +1 -0
  5. package/dist/{chunk-UHYPUIRH.js → chunk-3H3CVOZ3.js} +2 -2
  6. package/dist/chunk-3H3CVOZ3.js.map +1 -0
  7. package/dist/{chunk-MEPHGCPQ.js → chunk-5CJGKKMZ.js} +1 -1
  8. package/dist/chunk-5CJGKKMZ.js.map +1 -0
  9. package/dist/{chunk-QMJJI6TD.js → chunk-C5ABJ7PB.js} +6 -4
  10. package/dist/chunk-C5ABJ7PB.js.map +1 -0
  11. package/dist/chunk-DCZVOIEO.cjs.map +1 -1
  12. package/dist/{chunk-UNV7F3FK.js → chunk-EH2KYFFO.js} +2 -2
  13. package/dist/chunk-EH2KYFFO.js.map +1 -0
  14. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  15. package/dist/{chunk-NZJAXMN7.js → chunk-JMLK6NTW.js} +3 -3
  16. package/dist/chunk-JMLK6NTW.js.map +1 -0
  17. package/dist/chunk-MOL7MDBG.js +0 -0
  18. package/dist/{chunk-R2H34FY5.cjs → chunk-NIZXIVEI.cjs} +2 -2
  19. package/dist/chunk-NIZXIVEI.cjs.map +1 -0
  20. package/dist/{chunk-7K5P4RNT.js → chunk-SHVV3BD6.js} +1652 -588
  21. package/dist/chunk-SHVV3BD6.js.map +1 -0
  22. package/dist/{chunk-4RGDFDQ2.js → chunk-YEC7VG6O.js} +8 -2
  23. package/dist/chunk-YEC7VG6O.js.map +1 -0
  24. package/dist/cli.js +76 -16
  25. package/dist/cli.js.map +1 -1
  26. package/dist/{detect-RI2MQ33K.js → detect-PJZMUL2Z.js} +2 -2
  27. package/dist/formula-5NKVS2LR.cjs.map +1 -1
  28. package/dist/formula-JCNF43NE.js +0 -0
  29. package/dist/index.cjs +2036 -966
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +110 -9
  32. package/dist/index.d.ts +110 -9
  33. package/dist/index.js +1811 -741
  34. package/dist/index.js.map +1 -1
  35. package/dist/mcp.js +60 -17
  36. package/dist/mcp.js.map +1 -1
  37. package/dist/page-range-737B4EZW.js +0 -0
  38. package/dist/page-range-P7SDW6LR.cjs.map +1 -1
  39. package/dist/{parser-XEY5MRGV.cjs → parser-44OPXZMP.cjs} +15 -15
  40. package/dist/parser-44OPXZMP.cjs.map +1 -0
  41. package/dist/{parser-JBBA5A5E.js → parser-G433UZMX.js} +3 -3
  42. package/dist/parser-G433UZMX.js.map +1 -0
  43. package/dist/{parser-DOBK652H.js → parser-ZOMDHCA7.js} +4 -4
  44. package/dist/parser-ZOMDHCA7.js.map +1 -0
  45. package/dist/{provider-G4C2V2PD.cjs → provider-5K7O3Z2O.cjs} +1 -1
  46. package/dist/provider-5K7O3Z2O.cjs.map +1 -0
  47. package/dist/{provider-AKROB7WQ.js → provider-7H4CPZYS.js} +1 -1
  48. package/dist/provider-7H4CPZYS.js.map +1 -0
  49. package/dist/{provider-4ZJKV3DC.js → provider-H4WWSPOV.js} +1 -1
  50. package/dist/provider-H4WWSPOV.js.map +1 -0
  51. package/dist/render-SQVQBORJ.js +10 -0
  52. package/dist/seal-6E26L45Z.js +10 -0
  53. package/dist/setup-57FB3LSP.js +0 -0
  54. package/dist/{watch-2MNRQWGV.js → watch-UYT3ZCBM.js} +8 -8
  55. package/dist/watch-UYT3ZCBM.js.map +1 -0
  56. package/package.json +1 -1
  57. package/dist/chunk-2IBFK5ZO.js.map +0 -1
  58. package/dist/chunk-4RGDFDQ2.js.map +0 -1
  59. package/dist/chunk-7K5P4RNT.js.map +0 -1
  60. package/dist/chunk-MEPHGCPQ.js.map +0 -1
  61. package/dist/chunk-NZJAXMN7.js.map +0 -1
  62. package/dist/chunk-QMJJI6TD.js.map +0 -1
  63. package/dist/chunk-R2H34FY5.cjs.map +0 -1
  64. package/dist/chunk-UHYPUIRH.js.map +0 -1
  65. package/dist/chunk-UNV7F3FK.js.map +0 -1
  66. package/dist/parser-DOBK652H.js.map +0 -1
  67. package/dist/parser-JBBA5A5E.js.map +0 -1
  68. package/dist/parser-XEY5MRGV.cjs.map +0 -1
  69. package/dist/provider-4ZJKV3DC.js.map +0 -1
  70. package/dist/provider-AKROB7WQ.js.map +0 -1
  71. package/dist/provider-G4C2V2PD.cjs.map +0 -1
  72. package/dist/render-VX4H2S4F.js +0 -10
  73. package/dist/seal-6Z6H4YXN.js +0 -10
  74. package/dist/watch-2MNRQWGV.js.map +0 -1
  75. /package/dist/{-V66QW3WA.js.map → -O3AWNVPH.js.map} +0 -0
  76. /package/dist/{detect-RI2MQ33K.js.map → detect-PJZMUL2Z.js.map} +0 -0
  77. /package/dist/{render-VX4H2S4F.js.map → render-SQVQBORJ.js.map} +0 -0
  78. /package/dist/{seal-6Z6H4YXN.js.map → seal-6E26L45Z.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -579,6 +579,20 @@ interface PlaceSealResult {
579
579
  */
580
580
  declare function placeSealHwpx(hwpxBuffer: ArrayBuffer, ops: SealOp[]): Promise<PlaceSealResult>;
581
581
 
582
+ /** 요소별 글자 크기(pt) 오버라이드 — 미지정 요소는 bodyHeight 비례 기본값 */
583
+ type GaejosikSizeOverrides = Partial<{
584
+ dae: number;
585
+ cham: number;
586
+ chapter: number;
587
+ coverTitle: number;
588
+ coverSub: number;
589
+ tocLabel: number;
590
+ tocRoman: number;
591
+ tocItem: number;
592
+ table: number;
593
+ bodyTitle: number;
594
+ }>;
595
+
582
596
  /**
583
597
  * 공문서(公文書) 모드 — 한국 행정 공문서 표준 서식 렌더링 로직
584
598
  *
@@ -589,11 +603,12 @@ declare function placeSealHwpx(hwpxBuffer: ArrayBuffer, ops: SealOp[]): Promise<
589
603
  * 이 모듈은 **순수 로직**만 담는다(항목부호 시퀀스 생성, 단계별 들여쓰기 계산,
590
604
  * 프리셋 해석). 실제 XML 조립은 generator.ts가 한다.
591
605
  */
592
- type GongmunPreset = "official" | "report" | "plan" | "notice" | "minutes";
593
- type GongmunNumbering = "standard" | "report";
606
+
607
+ type GongmunPreset = "official" | "report" | "plan" | "notice" | "minutes" | "gaejosik";
608
+ type GongmunNumbering = "standard" | "report" | "gaejosik";
594
609
  type GongmunFont = "myeongjo" | "gothic";
595
610
  /** 프리셋 입력값 — 영문 키 또는 한글 별칭(기안문·보고서·계획서·통지·회의록 등) */
596
- type GongmunPresetInput = GongmunPreset | "기안문" | "시행문" | "공문" | "공문서" | "보고서" | "계획서" | "계획" | "통지" | "알림" | "안내" | "회의록";
611
+ type GongmunPresetInput = GongmunPreset | "기안문" | "시행문" | "공문" | "공문서" | "보고서" | "계획서" | "계획" | "통지" | "알림" | "안내" | "회의록" | "개조식" | "개조식보고서" | "정부보고서" | "정부표준개조식보고서";
597
612
  /** 공문서 모드 옵션 (전부 선택 — 프리셋 기본값을 개별 override) */
598
613
  interface GongmunOptions {
599
614
  /** 문서 종류 프리셋(영문 키 또는 한글 별칭). 기본 'official'(일반 기안문) */
@@ -604,8 +619,18 @@ interface GongmunOptions {
604
619
  bodyPt?: number;
605
620
  /** 본문 줄간격(%). 기본 160 (회의록 130) */
606
621
  lineSpacing?: number;
607
- /** 항목부호 체계. 'standard'=법정 8단계(1. 가. 1) …) / 'report'=보고서 불릿(□ ○ - ㆍ) */
622
+ /** 항목부호 체계. 'standard'=법정 8단계(1. 가. 1) …) / 'report'=보고서 불릿(□ ○ - ㆍ) / 'gaejosik'=개조식(□ ○ - ㆍ + 부호별 폰트) */
608
623
  numbering?: GongmunNumbering;
624
+ /**
625
+ * 표지 페이지(개조식 프리셋 기본 켜짐) — 첫 h1을 제목으로, 파랑 장식 바 + 날짜 + 기관명.
626
+ * false로 끄거나 {date, org}로 날짜(기본 오늘, 'YYYY. M. D.')·기관명(기본 생략) 지정.
627
+ */
628
+ cover?: boolean | {
629
+ date?: string;
630
+ org?: string;
631
+ };
632
+ /** 목차 페이지(개조식 프리셋 기본 켜짐) — h2 목록을 Ⅰ Ⅱ Ⅲ…로 자동 생성. false로 끔 */
633
+ toc?: boolean;
609
634
  /** 용지 여백(mm). 기본 공식값 위20/아래10/좌20/우20 */
610
635
  margins?: {
611
636
  top: number;
@@ -623,6 +648,34 @@ interface GongmunOptions {
623
648
  autoFit?: boolean | {
624
649
  minRatio?: number;
625
650
  };
651
+ /**
652
+ * 요소별 글꼴 오버라이드 — 기관 표준 폰트 적용이나 미설치 폰트 대체용.
653
+ * body=본문(개조식 ○·-) / heading=제목 계열(□·장헤더·표지·목차) / ref=※ 참고 / table=표 셀.
654
+ * 실측 폰트 프리셋(개조식·보고서·계획서)은 네 역할 전부, 그 외 프리셋은 body만
655
+ * 적용된다 (bodyFont보다 우선).
656
+ */
657
+ fonts?: {
658
+ body?: string;
659
+ heading?: string;
660
+ ref?: string;
661
+ table?: string;
662
+ };
663
+ /** 개조식 요소별 글자 크기(pt) 오버라이드 — 미지정 요소는 bodyPt 비례 기본값 */
664
+ sizes?: GaejosikSizeOverrides;
665
+ /** 쪽번호(하단 중앙 "- 1 -", 표지·목차는 카운트 제외). 기본: 개조식·보고서·계획서 켜짐 */
666
+ pageNumbers?: boolean;
667
+ /** 본문 끝 2타+"끝." 표시(행정업무규정). 기본: 기안문(official)만 켜짐 */
668
+ endMark?: boolean;
669
+ /** 결재란 — 직위 라벨 배열(예: ["담당","팀장","과장"]). 문서 최상단 우측 배치 */
670
+ approval?: string[];
671
+ /** 본문 첫 페이지 제목 박스(개조식) — 목차 뒤 본문 시작에 제목 반복(실측 관행). 기본: 표지 있으면 켜짐 */
672
+ bodyTitleBox?: boolean;
673
+ /**
674
+ * h2 섹션 제목 말머리 (비개조식 — 개조식 h2는 로마숫자 장 헤더가 대체).
675
+ * 'box'=□ 대항목(실측 보고서 양식 관행) / 'number'=아라비아 번호(1. 2. — 공고문 관행)
676
+ * / 'none'=말머리 없음. 기본: 보고서·계획서 'box', 그 외 'none'.
677
+ */
678
+ h2Marker?: "box" | "number" | "none";
626
679
  }
627
680
  /** 프리셋 별칭(한글/영문) → 내부 preset 키. CLI·라이브러리 공용 */
628
681
  declare const PRESET_ALIAS: Record<string, GongmunPreset>;
@@ -744,7 +797,9 @@ interface FormatProfile {
744
797
  * gen-header.ts — container/manifest/head.xml 생성
745
798
  * gen-gongmun-fit.ts — 공문 자동장평 계획 + 리스트 항목부호 선계산
746
799
  * gen-table.ts — GFM/HTML(병합) 표 XML
800
+ * gen-table-bf.ts — 표 셀 위치별 borderFill 동적 레지스트리 (실측 테두리 위계)
747
801
  * gen-section.ts — secPr + 본문 section0.xml 조립
802
+ * gen-profile.ts — 서식 프로필(#41) id 리맵·표 매칭
748
803
  */
749
804
 
750
805
  /** markdownToHwpx 옵션 */
@@ -760,7 +815,7 @@ interface MarkdownToHwpxOptions {
760
815
  * 서식 프로필 — 표의 borderFill(테두리·음영)·열 너비·셀 글꼴을 원본 문서 없이
761
816
  * 재현한다(이슈 #41). `hwpxToProfile()`로 추출하거나 직접 작성한 프로필을 넘기면,
762
817
  * 문서 내 표 등장 순서(table_index)로 매칭해 셀 좌표별 서식을 적용한다.
763
- * 미지정 시 기존 기본 서식(단일 SOLID 테두리·균등 열폭) 그대로.
818
+ * 미지정 시 기본 서식 — 공문서 모드는 실측 정부 표 문법, 그 외 단일 SOLID 테두리.
764
819
  */
765
820
  profile?: FormatProfile;
766
821
  }
@@ -787,6 +842,50 @@ declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOption
787
842
  */
788
843
  declare function hwpxToProfile(input: ArrayBuffer | Buffer): Promise<FormatProfile>;
789
844
 
845
+ /**
846
+ * 폰트 카탈로그 — fonts 오버라이드 오타·미설치 경고용 (A2).
847
+ *
848
+ * 생성은 항상 진행하고 경고만 낸다: HWPX는 폰트명을 문자열로 참조하므로
849
+ * 미설치 폰트를 지정해도 파일은 유효하지만, 한컴이 무경고로 기본 폰트로
850
+ * 대체 렌더해 "지정한 폰트가 안 먹는" 원인 파악이 어렵다.
851
+ * 여기 목록은 한컴오피스 번들 + Windows 한글판 기본 + 통상 설치 무료 폰트.
852
+ * 목록에 없다고 오류는 아니다 — 경고 문구도 그렇게 안내한다.
853
+ */
854
+ /** 카탈로그에 있는 폰트인가 */
855
+ declare function isKnownFont(name: string): boolean;
856
+ /**
857
+ * fonts 오버라이드 경고 목록 — 카탈로그에 없는 폰트명마다 경고 1건.
858
+ * 빈 배열이면 전부 알려진 폰트. 경고는 생성을 막지 않는다.
859
+ */
860
+ declare function unknownFontWarnings(fonts: Record<string, string | undefined>): string[];
861
+
862
+ /**
863
+ * 공문서 표기법 검수기 — 「행정업무의 운영 및 혁신에 관한 규정」 시행규칙 및
864
+ * 행정안전부 행정업무운영 편람의 날짜·시간·금액·기호 표기법을 정규식으로 검사.
865
+ *
866
+ * 원전: jkf87/hwpx-skill gonmun_lint.py(2025 편람 기준 13룰)를 kordoc에 맞게 이식
867
+ * (v4.0.1). URL 쌍점 오탐 가드 등 일부 보강. 검사는 조언용이다 — 생성은 막지 않고
868
+ * 경고만 낸다 (A2 폰트경고와 같은 원칙). 별도 CLI `kordoc lint`는 error 시 exit 1.
869
+ */
870
+ interface GongmunLintFinding {
871
+ /** 1-based 줄 번호 */
872
+ line: number;
873
+ /** 걸린 원문 조각 */
874
+ match: string;
875
+ /** 규칙 코드 (DATE_NO_SPACE 등) */
876
+ rule: string;
877
+ severity: "error" | "warning";
878
+ message: string;
879
+ suggest?: string;
880
+ }
881
+ /**
882
+ * 텍스트(마크다운 포함) 표기법 검수. 마크다운 펜스 코드블록(``` ~ ```) 안은
883
+ * 건너뛴다 — 코드·URL이 날짜/쌍점 규칙에 오탐되는 것 방지.
884
+ */
885
+ declare function lintGongmunText(text: string): GongmunLintFinding[];
886
+ /** 검수 결과를 사람이 읽는 경고 문자열 배열로 — generate 경고 채널(A2와 동일)용 */
887
+ declare function gongmunLintWarnings(text: string, limit?: number): string[];
888
+
790
889
  /**
791
890
  * 한글 조판 텍스트 폭 계산 — 함초롬바탕(HCR Batang) 실측 advance 테이블
792
891
  *
@@ -832,8 +931,8 @@ interface WrapResult {
832
931
  }
833
932
  /**
834
933
  * 문단 줄바꿈 시뮬레이션.
835
- * mode 'keep' = breakNonLatinWord=KEEP_WORD(어절 단위, 공문서 모드·Windows 한글),
836
- * mode 'charAll' = 글자 단위(BREAK_WORD·macOS 한글·전자결재 변환기의 실동작).
934
+ * mode 'keep' = 어절 단위(공문서 모드 — 저장 속성 breakNonLatinWord="BREAK_WORD", 이름 역전 주의),
935
+ * mode 'charAll' = 글자 단위(breakNonLatinWord="KEEP_WORD" 한글 기본값·전자결재 변환기).
837
936
  * 한 어절이 줄보다 길면 keep에서도 글자 단위로 강제 분해(한컴 동일).
838
937
  *
839
938
  * @param text 문단 전체 텍스트(항목 부호 포함)
@@ -1224,7 +1323,9 @@ interface RenderSvgOptions {
1224
1323
  /** Tier-2 reflow — 조판 캐시(linesegarray) 없는 파일도 순수 TS 조판으로 렌더.
1225
1324
  * 캐시가 있으면 무시(한컴본은 캐시 재생). 기본 false(캐시 없으면 KordocError). */
1226
1325
  reflow?: boolean;
1227
- /** reflow 줄바꿈 모드 — 'keep'(어절, Windows 한글·공문서) / 'charAll'(글자, macOS·전자결재) */
1326
+ /** reflow 줄바꿈 폴백 모드 — 'keep'(어절) / 'charAll'(글자). 문단 paraPr에
1327
+ * breakSetting 선언이 있으면 그 값이 우선하며(BREAK_WORD=어절, KEEP_WORD=글자 —
1328
+ * 이름 역전 주의), 이 옵션은 선언 없는 문단에만 적용된다. */
1228
1329
  reflowMode?: WrapMode;
1229
1330
  }
1230
1331
  interface RenderSvgResult {
@@ -1349,4 +1450,4 @@ interface FillFormOutput {
1349
1450
  */
1350
1451
  declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
1351
1452
 
1352
- 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 };
1453
+ 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 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 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, gongmunLintWarnings, hwpxToProfile, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
package/dist/index.d.ts CHANGED
@@ -579,6 +579,20 @@ interface PlaceSealResult {
579
579
  */
580
580
  declare function placeSealHwpx(hwpxBuffer: ArrayBuffer, ops: SealOp[]): Promise<PlaceSealResult>;
581
581
 
582
+ /** 요소별 글자 크기(pt) 오버라이드 — 미지정 요소는 bodyHeight 비례 기본값 */
583
+ type GaejosikSizeOverrides = Partial<{
584
+ dae: number;
585
+ cham: number;
586
+ chapter: number;
587
+ coverTitle: number;
588
+ coverSub: number;
589
+ tocLabel: number;
590
+ tocRoman: number;
591
+ tocItem: number;
592
+ table: number;
593
+ bodyTitle: number;
594
+ }>;
595
+
582
596
  /**
583
597
  * 공문서(公文書) 모드 — 한국 행정 공문서 표준 서식 렌더링 로직
584
598
  *
@@ -589,11 +603,12 @@ declare function placeSealHwpx(hwpxBuffer: ArrayBuffer, ops: SealOp[]): Promise<
589
603
  * 이 모듈은 **순수 로직**만 담는다(항목부호 시퀀스 생성, 단계별 들여쓰기 계산,
590
604
  * 프리셋 해석). 실제 XML 조립은 generator.ts가 한다.
591
605
  */
592
- type GongmunPreset = "official" | "report" | "plan" | "notice" | "minutes";
593
- type GongmunNumbering = "standard" | "report";
606
+
607
+ type GongmunPreset = "official" | "report" | "plan" | "notice" | "minutes" | "gaejosik";
608
+ type GongmunNumbering = "standard" | "report" | "gaejosik";
594
609
  type GongmunFont = "myeongjo" | "gothic";
595
610
  /** 프리셋 입력값 — 영문 키 또는 한글 별칭(기안문·보고서·계획서·통지·회의록 등) */
596
- type GongmunPresetInput = GongmunPreset | "기안문" | "시행문" | "공문" | "공문서" | "보고서" | "계획서" | "계획" | "통지" | "알림" | "안내" | "회의록";
611
+ type GongmunPresetInput = GongmunPreset | "기안문" | "시행문" | "공문" | "공문서" | "보고서" | "계획서" | "계획" | "통지" | "알림" | "안내" | "회의록" | "개조식" | "개조식보고서" | "정부보고서" | "정부표준개조식보고서";
597
612
  /** 공문서 모드 옵션 (전부 선택 — 프리셋 기본값을 개별 override) */
598
613
  interface GongmunOptions {
599
614
  /** 문서 종류 프리셋(영문 키 또는 한글 별칭). 기본 'official'(일반 기안문) */
@@ -604,8 +619,18 @@ interface GongmunOptions {
604
619
  bodyPt?: number;
605
620
  /** 본문 줄간격(%). 기본 160 (회의록 130) */
606
621
  lineSpacing?: number;
607
- /** 항목부호 체계. 'standard'=법정 8단계(1. 가. 1) …) / 'report'=보고서 불릿(□ ○ - ㆍ) */
622
+ /** 항목부호 체계. 'standard'=법정 8단계(1. 가. 1) …) / 'report'=보고서 불릿(□ ○ - ㆍ) / 'gaejosik'=개조식(□ ○ - ㆍ + 부호별 폰트) */
608
623
  numbering?: GongmunNumbering;
624
+ /**
625
+ * 표지 페이지(개조식 프리셋 기본 켜짐) — 첫 h1을 제목으로, 파랑 장식 바 + 날짜 + 기관명.
626
+ * false로 끄거나 {date, org}로 날짜(기본 오늘, 'YYYY. M. D.')·기관명(기본 생략) 지정.
627
+ */
628
+ cover?: boolean | {
629
+ date?: string;
630
+ org?: string;
631
+ };
632
+ /** 목차 페이지(개조식 프리셋 기본 켜짐) — h2 목록을 Ⅰ Ⅱ Ⅲ…로 자동 생성. false로 끔 */
633
+ toc?: boolean;
609
634
  /** 용지 여백(mm). 기본 공식값 위20/아래10/좌20/우20 */
610
635
  margins?: {
611
636
  top: number;
@@ -623,6 +648,34 @@ interface GongmunOptions {
623
648
  autoFit?: boolean | {
624
649
  minRatio?: number;
625
650
  };
651
+ /**
652
+ * 요소별 글꼴 오버라이드 — 기관 표준 폰트 적용이나 미설치 폰트 대체용.
653
+ * body=본문(개조식 ○·-) / heading=제목 계열(□·장헤더·표지·목차) / ref=※ 참고 / table=표 셀.
654
+ * 실측 폰트 프리셋(개조식·보고서·계획서)은 네 역할 전부, 그 외 프리셋은 body만
655
+ * 적용된다 (bodyFont보다 우선).
656
+ */
657
+ fonts?: {
658
+ body?: string;
659
+ heading?: string;
660
+ ref?: string;
661
+ table?: string;
662
+ };
663
+ /** 개조식 요소별 글자 크기(pt) 오버라이드 — 미지정 요소는 bodyPt 비례 기본값 */
664
+ sizes?: GaejosikSizeOverrides;
665
+ /** 쪽번호(하단 중앙 "- 1 -", 표지·목차는 카운트 제외). 기본: 개조식·보고서·계획서 켜짐 */
666
+ pageNumbers?: boolean;
667
+ /** 본문 끝 2타+"끝." 표시(행정업무규정). 기본: 기안문(official)만 켜짐 */
668
+ endMark?: boolean;
669
+ /** 결재란 — 직위 라벨 배열(예: ["담당","팀장","과장"]). 문서 최상단 우측 배치 */
670
+ approval?: string[];
671
+ /** 본문 첫 페이지 제목 박스(개조식) — 목차 뒤 본문 시작에 제목 반복(실측 관행). 기본: 표지 있으면 켜짐 */
672
+ bodyTitleBox?: boolean;
673
+ /**
674
+ * h2 섹션 제목 말머리 (비개조식 — 개조식 h2는 로마숫자 장 헤더가 대체).
675
+ * 'box'=□ 대항목(실측 보고서 양식 관행) / 'number'=아라비아 번호(1. 2. — 공고문 관행)
676
+ * / 'none'=말머리 없음. 기본: 보고서·계획서 'box', 그 외 'none'.
677
+ */
678
+ h2Marker?: "box" | "number" | "none";
626
679
  }
627
680
  /** 프리셋 별칭(한글/영문) → 내부 preset 키. CLI·라이브러리 공용 */
628
681
  declare const PRESET_ALIAS: Record<string, GongmunPreset>;
@@ -744,7 +797,9 @@ interface FormatProfile {
744
797
  * gen-header.ts — container/manifest/head.xml 생성
745
798
  * gen-gongmun-fit.ts — 공문 자동장평 계획 + 리스트 항목부호 선계산
746
799
  * gen-table.ts — GFM/HTML(병합) 표 XML
800
+ * gen-table-bf.ts — 표 셀 위치별 borderFill 동적 레지스트리 (실측 테두리 위계)
747
801
  * gen-section.ts — secPr + 본문 section0.xml 조립
802
+ * gen-profile.ts — 서식 프로필(#41) id 리맵·표 매칭
748
803
  */
749
804
 
750
805
  /** markdownToHwpx 옵션 */
@@ -760,7 +815,7 @@ interface MarkdownToHwpxOptions {
760
815
  * 서식 프로필 — 표의 borderFill(테두리·음영)·열 너비·셀 글꼴을 원본 문서 없이
761
816
  * 재현한다(이슈 #41). `hwpxToProfile()`로 추출하거나 직접 작성한 프로필을 넘기면,
762
817
  * 문서 내 표 등장 순서(table_index)로 매칭해 셀 좌표별 서식을 적용한다.
763
- * 미지정 시 기존 기본 서식(단일 SOLID 테두리·균등 열폭) 그대로.
818
+ * 미지정 시 기본 서식 — 공문서 모드는 실측 정부 표 문법, 그 외 단일 SOLID 테두리.
764
819
  */
765
820
  profile?: FormatProfile;
766
821
  }
@@ -787,6 +842,50 @@ declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOption
787
842
  */
788
843
  declare function hwpxToProfile(input: ArrayBuffer | Buffer): Promise<FormatProfile>;
789
844
 
845
+ /**
846
+ * 폰트 카탈로그 — fonts 오버라이드 오타·미설치 경고용 (A2).
847
+ *
848
+ * 생성은 항상 진행하고 경고만 낸다: HWPX는 폰트명을 문자열로 참조하므로
849
+ * 미설치 폰트를 지정해도 파일은 유효하지만, 한컴이 무경고로 기본 폰트로
850
+ * 대체 렌더해 "지정한 폰트가 안 먹는" 원인 파악이 어렵다.
851
+ * 여기 목록은 한컴오피스 번들 + Windows 한글판 기본 + 통상 설치 무료 폰트.
852
+ * 목록에 없다고 오류는 아니다 — 경고 문구도 그렇게 안내한다.
853
+ */
854
+ /** 카탈로그에 있는 폰트인가 */
855
+ declare function isKnownFont(name: string): boolean;
856
+ /**
857
+ * fonts 오버라이드 경고 목록 — 카탈로그에 없는 폰트명마다 경고 1건.
858
+ * 빈 배열이면 전부 알려진 폰트. 경고는 생성을 막지 않는다.
859
+ */
860
+ declare function unknownFontWarnings(fonts: Record<string, string | undefined>): string[];
861
+
862
+ /**
863
+ * 공문서 표기법 검수기 — 「행정업무의 운영 및 혁신에 관한 규정」 시행규칙 및
864
+ * 행정안전부 행정업무운영 편람의 날짜·시간·금액·기호 표기법을 정규식으로 검사.
865
+ *
866
+ * 원전: jkf87/hwpx-skill gonmun_lint.py(2025 편람 기준 13룰)를 kordoc에 맞게 이식
867
+ * (v4.0.1). URL 쌍점 오탐 가드 등 일부 보강. 검사는 조언용이다 — 생성은 막지 않고
868
+ * 경고만 낸다 (A2 폰트경고와 같은 원칙). 별도 CLI `kordoc lint`는 error 시 exit 1.
869
+ */
870
+ interface GongmunLintFinding {
871
+ /** 1-based 줄 번호 */
872
+ line: number;
873
+ /** 걸린 원문 조각 */
874
+ match: string;
875
+ /** 규칙 코드 (DATE_NO_SPACE 등) */
876
+ rule: string;
877
+ severity: "error" | "warning";
878
+ message: string;
879
+ suggest?: string;
880
+ }
881
+ /**
882
+ * 텍스트(마크다운 포함) 표기법 검수. 마크다운 펜스 코드블록(``` ~ ```) 안은
883
+ * 건너뛴다 — 코드·URL이 날짜/쌍점 규칙에 오탐되는 것 방지.
884
+ */
885
+ declare function lintGongmunText(text: string): GongmunLintFinding[];
886
+ /** 검수 결과를 사람이 읽는 경고 문자열 배열로 — generate 경고 채널(A2와 동일)용 */
887
+ declare function gongmunLintWarnings(text: string, limit?: number): string[];
888
+
790
889
  /**
791
890
  * 한글 조판 텍스트 폭 계산 — 함초롬바탕(HCR Batang) 실측 advance 테이블
792
891
  *
@@ -832,8 +931,8 @@ interface WrapResult {
832
931
  }
833
932
  /**
834
933
  * 문단 줄바꿈 시뮬레이션.
835
- * mode 'keep' = breakNonLatinWord=KEEP_WORD(어절 단위, 공문서 모드·Windows 한글),
836
- * mode 'charAll' = 글자 단위(BREAK_WORD·macOS 한글·전자결재 변환기의 실동작).
934
+ * mode 'keep' = 어절 단위(공문서 모드 — 저장 속성 breakNonLatinWord="BREAK_WORD", 이름 역전 주의),
935
+ * mode 'charAll' = 글자 단위(breakNonLatinWord="KEEP_WORD" 한글 기본값·전자결재 변환기).
837
936
  * 한 어절이 줄보다 길면 keep에서도 글자 단위로 강제 분해(한컴 동일).
838
937
  *
839
938
  * @param text 문단 전체 텍스트(항목 부호 포함)
@@ -1224,7 +1323,9 @@ interface RenderSvgOptions {
1224
1323
  /** Tier-2 reflow — 조판 캐시(linesegarray) 없는 파일도 순수 TS 조판으로 렌더.
1225
1324
  * 캐시가 있으면 무시(한컴본은 캐시 재생). 기본 false(캐시 없으면 KordocError). */
1226
1325
  reflow?: boolean;
1227
- /** reflow 줄바꿈 모드 — 'keep'(어절, Windows 한글·공문서) / 'charAll'(글자, macOS·전자결재) */
1326
+ /** reflow 줄바꿈 폴백 모드 — 'keep'(어절) / 'charAll'(글자). 문단 paraPr에
1327
+ * breakSetting 선언이 있으면 그 값이 우선하며(BREAK_WORD=어절, KEEP_WORD=글자 —
1328
+ * 이름 역전 주의), 이 옵션은 선언 없는 문단에만 적용된다. */
1228
1329
  reflowMode?: WrapMode;
1229
1330
  }
1230
1331
  interface RenderSvgResult {
@@ -1349,4 +1450,4 @@ interface FillFormOutput {
1349
1450
  */
1350
1451
  declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
1351
1452
 
1352
- 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 };
1453
+ 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 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 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, gongmunLintWarnings, hwpxToProfile, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };