kordoc 3.1.1 → 3.2.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 (60) hide show
  1. package/README.md +584 -559
  2. package/dist/{-UCE73NNK.js → -NMUBDTYV.js} +4 -4
  3. package/dist/chunk-DCZVOIEO.cjs.map +1 -1
  4. package/dist/{chunk-KR6DSGM7.js → chunk-F4A7OTBT.js} +2 -2
  5. package/dist/chunk-F4A7OTBT.js.map +1 -0
  6. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  7. package/dist/{chunk-VMUP5WPI.js → chunk-LPKAF45D.js} +257 -43
  8. package/dist/chunk-LPKAF45D.js.map +1 -0
  9. package/dist/{chunk-5CJGKKMZ.js → chunk-MEPHGCPQ.js} +1 -1
  10. package/dist/chunk-MEPHGCPQ.js.map +1 -0
  11. package/dist/chunk-MOL7MDBG.js +0 -0
  12. package/dist/{chunk-ZZNSI4GV.js → chunk-Q7IWG4E3.js} +2 -2
  13. package/dist/chunk-Q7IWG4E3.js.map +1 -0
  14. package/dist/{chunk-FJON4QNB.cjs → chunk-ZY524HB6.cjs} +2 -2
  15. package/dist/chunk-ZY524HB6.cjs.map +1 -0
  16. package/dist/cli.js +72 -5
  17. package/dist/cli.js.map +1 -1
  18. package/dist/{detect-PJZMUL2Z.js → detect-RI2MQ33K.js} +2 -2
  19. package/dist/formula-5NKVS2LR.cjs.map +1 -1
  20. package/dist/formula-JCNF43NE.js +0 -0
  21. package/dist/index.cjs +419 -205
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +44 -2
  24. package/dist/index.d.ts +44 -2
  25. package/dist/index.js +255 -41
  26. package/dist/index.js.map +1 -1
  27. package/dist/mcp.js +5 -5
  28. package/dist/mcp.js.map +1 -1
  29. package/dist/page-range-737B4EZW.js +0 -0
  30. package/dist/page-range-P7SDW6LR.cjs.map +1 -1
  31. package/dist/{parser-XULVNDMN.cjs → parser-CV3FOVOS.cjs} +15 -15
  32. package/dist/parser-CV3FOVOS.cjs.map +1 -0
  33. package/dist/{parser-4L7UFVEP.js → parser-HC5NXB3F.js} +3 -3
  34. package/dist/parser-HC5NXB3F.js.map +1 -0
  35. package/dist/{parser-QTJL6IQY.js → parser-ZWGQCMRS.js} +3 -3
  36. package/dist/parser-ZWGQCMRS.js.map +1 -0
  37. package/dist/{provider-H4WWSPOV.js → provider-4ZJKV3DC.js} +1 -1
  38. package/dist/provider-4ZJKV3DC.js.map +1 -0
  39. package/dist/{provider-7H4CPZYS.js → provider-AKROB7WQ.js} +1 -1
  40. package/dist/provider-AKROB7WQ.js.map +1 -0
  41. package/dist/{provider-5K7O3Z2O.cjs → provider-G4C2V2PD.cjs} +1 -1
  42. package/dist/provider-G4C2V2PD.cjs.map +1 -0
  43. package/dist/setup-57FB3LSP.js +0 -0
  44. package/dist/{watch-FPDSHB23.js → watch-IUEQDWC3.js} +4 -4
  45. package/dist/watch-IUEQDWC3.js.map +1 -0
  46. package/package.json +98 -98
  47. package/dist/chunk-5CJGKKMZ.js.map +0 -1
  48. package/dist/chunk-FJON4QNB.cjs.map +0 -1
  49. package/dist/chunk-KR6DSGM7.js.map +0 -1
  50. package/dist/chunk-VMUP5WPI.js.map +0 -1
  51. package/dist/chunk-ZZNSI4GV.js.map +0 -1
  52. package/dist/parser-4L7UFVEP.js.map +0 -1
  53. package/dist/parser-QTJL6IQY.js.map +0 -1
  54. package/dist/parser-XULVNDMN.cjs.map +0 -1
  55. package/dist/provider-5K7O3Z2O.cjs.map +0 -1
  56. package/dist/provider-7H4CPZYS.js.map +0 -1
  57. package/dist/provider-H4WWSPOV.js.map +0 -1
  58. package/dist/watch-FPDSHB23.js.map +0 -1
  59. /package/dist/{-UCE73NNK.js.map → -NMUBDTYV.js.map} +0 -0
  60. /package/dist/{detect-PJZMUL2Z.js.map → detect-RI2MQ33K.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -422,6 +422,42 @@ interface HwpxFillResult {
422
422
  */
423
423
  declare function fillHwpx(hwpxBuffer: ArrayBuffer, values: Record<string, string>): Promise<HwpxFillResult>;
424
424
 
425
+ /**
426
+ * 공문서(公文書) 모드 — 한국 행정 공문서 표준 서식 렌더링 로직
427
+ *
428
+ * 근거: 「행정업무의 운영 및 혁신에 관한 규정」 및 동 시행규칙(제2조 항목 표시),
429
+ * 행정안전부 「2020 행정업무운영 편람」.
430
+ * 자세한 표준은 docs/gongmunseo-reference.md, 구현 매핑은 docs/gongmunseo-engine-spec.md 참조.
431
+ *
432
+ * 이 모듈은 **순수 로직**만 담는다(항목부호 시퀀스 생성, 단계별 들여쓰기 계산,
433
+ * 프리셋 해석). 실제 XML 조립은 generator.ts가 한다.
434
+ */
435
+ type GongmunPreset = "official" | "report" | "plan" | "notice" | "minutes";
436
+ type GongmunNumbering = "standard" | "report";
437
+ type GongmunFont = "myeongjo" | "gothic";
438
+ /** 공문서 모드 옵션 (전부 선택 — 프리셋 기본값을 개별 override) */
439
+ interface GongmunOptions {
440
+ /** 문서 종류 프리셋. 기본 'official'(일반 기안문) */
441
+ preset?: GongmunPreset;
442
+ /** 본문 글꼴. 'myeongjo'=함초롬바탕(명조, 보고서·대외공문 관행) / 'gothic'=맑은 고딕(전자결재 기본) */
443
+ bodyFont?: GongmunFont;
444
+ /** 본문 글자 크기(pt). 기본 15 */
445
+ bodyPt?: number;
446
+ /** 본문 줄간격(%). 기본 160 (회의록 130) */
447
+ lineSpacing?: number;
448
+ /** 항목부호 체계. 'standard'=법정 8단계(1. 가. 1) …) / 'report'=보고서 불릿(□ ○ - ㆍ) */
449
+ numbering?: GongmunNumbering;
450
+ /** 용지 여백(mm). 기본 공식값 위20/아래10/좌20/우20 */
451
+ margins?: {
452
+ top: number;
453
+ bottom: number;
454
+ left: number;
455
+ right: number;
456
+ };
457
+ /** 문서 제목(첫 h1)을 가운데 정렬. 기본 true (행정기관명·보고서 제목) */
458
+ centerTitle?: boolean;
459
+ }
460
+
425
461
  /**
426
462
  * Markdown → HWPX 역변환
427
463
  *
@@ -429,6 +465,7 @@ declare function fillHwpx(hwpxBuffer: ArrayBuffer, values: Record<string, string
429
465
  * 순서/비순서 리스트, 수평선, 인용문, 테이블
430
466
  * jszip으로 HWPX ZIP 패키징.
431
467
  */
468
+
432
469
  /** HWPX 생성 시 적용할 시각 테마 (모두 선택) */
433
470
  interface HwpxTheme {
434
471
  /**
@@ -454,6 +491,12 @@ interface HwpxTheme {
454
491
  /** markdownToHwpx 옵션 */
455
492
  interface MarkdownToHwpxOptions {
456
493
  theme?: HwpxTheme;
494
+ /**
495
+ * 공문서 모드 — 지정 시 한국 행정 공문서 표준 서식으로 렌더링한다.
496
+ * (공식 여백, 명조 15pt 본문, 항목부호 8단계 행갈굼 정렬, 줄간격 등)
497
+ * 미지정 시 기존 범용 마크다운 변환 동작 그대로 유지.
498
+ */
499
+ gongmun?: GongmunOptions;
457
500
  }
458
501
  /**
459
502
  * 마크다운 텍스트를 HWPX (ArrayBuffer)로 변환.
@@ -573,7 +616,6 @@ declare function buildParagraphSplices(para: ScanParagraph, newText: string, xml
573
616
  * 오프셋 정합이 깨지므로 null을 반환한다 (호출자가 폴백 결정).
574
617
  */
575
618
  declare function buildRangeSplices(para: ScanParagraph, xml: string, start: number, end: number, replacement: string): SpliceEdit[] | null;
576
- /** splice 일괄 적용 — 겹침 검증 후 뒤에서부터 치환 */
577
619
  declare function applySplices(xml: string, splices: SpliceEdit[]): string;
578
620
 
579
621
  /**
@@ -861,4 +903,4 @@ interface FillFormOutput {
861
903
  */
862
904
  declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, string>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
863
905
 
864
- export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SectionScan, type SpliceEdit, type TRange, VERSION, type WarningCode, type WatchOptions, applySplices, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, renderHtml, scanSectionXml };
906
+ export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type GongmunFont, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SectionScan, type SpliceEdit, type TRange, VERSION, type WarningCode, type WatchOptions, applySplices, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, renderHtml, scanSectionXml };
package/dist/index.d.ts CHANGED
@@ -422,6 +422,42 @@ interface HwpxFillResult {
422
422
  */
423
423
  declare function fillHwpx(hwpxBuffer: ArrayBuffer, values: Record<string, string>): Promise<HwpxFillResult>;
424
424
 
425
+ /**
426
+ * 공문서(公文書) 모드 — 한국 행정 공문서 표준 서식 렌더링 로직
427
+ *
428
+ * 근거: 「행정업무의 운영 및 혁신에 관한 규정」 및 동 시행규칙(제2조 항목 표시),
429
+ * 행정안전부 「2020 행정업무운영 편람」.
430
+ * 자세한 표준은 docs/gongmunseo-reference.md, 구현 매핑은 docs/gongmunseo-engine-spec.md 참조.
431
+ *
432
+ * 이 모듈은 **순수 로직**만 담는다(항목부호 시퀀스 생성, 단계별 들여쓰기 계산,
433
+ * 프리셋 해석). 실제 XML 조립은 generator.ts가 한다.
434
+ */
435
+ type GongmunPreset = "official" | "report" | "plan" | "notice" | "minutes";
436
+ type GongmunNumbering = "standard" | "report";
437
+ type GongmunFont = "myeongjo" | "gothic";
438
+ /** 공문서 모드 옵션 (전부 선택 — 프리셋 기본값을 개별 override) */
439
+ interface GongmunOptions {
440
+ /** 문서 종류 프리셋. 기본 'official'(일반 기안문) */
441
+ preset?: GongmunPreset;
442
+ /** 본문 글꼴. 'myeongjo'=함초롬바탕(명조, 보고서·대외공문 관행) / 'gothic'=맑은 고딕(전자결재 기본) */
443
+ bodyFont?: GongmunFont;
444
+ /** 본문 글자 크기(pt). 기본 15 */
445
+ bodyPt?: number;
446
+ /** 본문 줄간격(%). 기본 160 (회의록 130) */
447
+ lineSpacing?: number;
448
+ /** 항목부호 체계. 'standard'=법정 8단계(1. 가. 1) …) / 'report'=보고서 불릿(□ ○ - ㆍ) */
449
+ numbering?: GongmunNumbering;
450
+ /** 용지 여백(mm). 기본 공식값 위20/아래10/좌20/우20 */
451
+ margins?: {
452
+ top: number;
453
+ bottom: number;
454
+ left: number;
455
+ right: number;
456
+ };
457
+ /** 문서 제목(첫 h1)을 가운데 정렬. 기본 true (행정기관명·보고서 제목) */
458
+ centerTitle?: boolean;
459
+ }
460
+
425
461
  /**
426
462
  * Markdown → HWPX 역변환
427
463
  *
@@ -429,6 +465,7 @@ declare function fillHwpx(hwpxBuffer: ArrayBuffer, values: Record<string, string
429
465
  * 순서/비순서 리스트, 수평선, 인용문, 테이블
430
466
  * jszip으로 HWPX ZIP 패키징.
431
467
  */
468
+
432
469
  /** HWPX 생성 시 적용할 시각 테마 (모두 선택) */
433
470
  interface HwpxTheme {
434
471
  /**
@@ -454,6 +491,12 @@ interface HwpxTheme {
454
491
  /** markdownToHwpx 옵션 */
455
492
  interface MarkdownToHwpxOptions {
456
493
  theme?: HwpxTheme;
494
+ /**
495
+ * 공문서 모드 — 지정 시 한국 행정 공문서 표준 서식으로 렌더링한다.
496
+ * (공식 여백, 명조 15pt 본문, 항목부호 8단계 행갈굼 정렬, 줄간격 등)
497
+ * 미지정 시 기존 범용 마크다운 변환 동작 그대로 유지.
498
+ */
499
+ gongmun?: GongmunOptions;
457
500
  }
458
501
  /**
459
502
  * 마크다운 텍스트를 HWPX (ArrayBuffer)로 변환.
@@ -573,7 +616,6 @@ declare function buildParagraphSplices(para: ScanParagraph, newText: string, xml
573
616
  * 오프셋 정합이 깨지므로 null을 반환한다 (호출자가 폴백 결정).
574
617
  */
575
618
  declare function buildRangeSplices(para: ScanParagraph, xml: string, start: number, end: number, replacement: string): SpliceEdit[] | null;
576
- /** splice 일괄 적용 — 겹침 검증 후 뒤에서부터 치환 */
577
619
  declare function applySplices(xml: string, splices: SpliceEdit[]): string;
578
620
 
579
621
  /**
@@ -861,4 +903,4 @@ interface FillFormOutput {
861
903
  */
862
904
  declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, string>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
863
905
 
864
- export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SectionScan, type SpliceEdit, type TRange, VERSION, type WarningCode, type WatchOptions, applySplices, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, renderHtml, scanSectionXml };
906
+ export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type GongmunFont, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PrintOptions, type PrintPreset, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SectionScan, type SpliceEdit, type TRange, VERSION, type WarningCode, type WatchOptions, applySplices, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, inferFieldType, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, renderHtml, scanSectionXml };
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  sanitizeHref,
18
18
  stripDtd,
19
19
  toArrayBuffer
20
- } from "./chunk-ZZNSI4GV.js";
20
+ } from "./chunk-Q7IWG4E3.js";
21
21
  import {
22
22
  parsePageRange
23
23
  } from "./chunk-GE43BE46.js";
@@ -19582,6 +19582,15 @@ function buildRangeSplices(para, xml, start, end, replacement) {
19582
19582
  }
19583
19583
  return placed ? splices : null;
19584
19584
  }
19585
+ function allLinesegRemovalSplices(xml) {
19586
+ const segRe = /<(\w+:)?linesegarray\b[^>]*?(?:\/>|>[\s\S]*?<\/\1linesegarray>)/g;
19587
+ const splices = [];
19588
+ let m;
19589
+ while ((m = segRe.exec(xml)) !== null) {
19590
+ splices.push({ start: m.index, end: m.index + m[0].length, replacement: "" });
19591
+ }
19592
+ return splices;
19593
+ }
19585
19594
  function applySplices(xml, splices) {
19586
19595
  const sorted = [...splices].sort((a, b) => a.start - b.start);
19587
19596
  for (let i = 1; i < sorted.length; i++) {
@@ -19978,9 +19987,115 @@ async function fillHwpx(hwpxBuffer, values) {
19978
19987
 
19979
19988
  // src/hwpx/generator.ts
19980
19989
  import JSZip6 from "jszip";
19990
+
19991
+ // src/hwpx/gongmun.ts
19992
+ var OFFICIAL_MARGINS = { top: 20, bottom: 10, left: 20, right: 20 };
19993
+ var PRESET_DEFAULTS = {
19994
+ official: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
19995
+ report: { bodyPt: 15, lineSpacing: 160, numbering: "report" },
19996
+ plan: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
19997
+ notice: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
19998
+ minutes: { bodyPt: 14, lineSpacing: 130, numbering: "standard" }
19999
+ };
20000
+ function resolveGongmun(opts) {
20001
+ const preset = opts.preset ?? "official";
20002
+ const d = PRESET_DEFAULTS[preset];
20003
+ const bodyPt = opts.bodyPt ?? d.bodyPt;
20004
+ return {
20005
+ preset,
20006
+ bodyFont: opts.bodyFont ?? "myeongjo",
20007
+ bodyHeight: Math.round(bodyPt * 100),
20008
+ lineSpacing: opts.lineSpacing ?? d.lineSpacing,
20009
+ numbering: opts.numbering ?? d.numbering,
20010
+ margins: opts.margins ?? OFFICIAL_MARGINS,
20011
+ centerTitle: opts.centerTitle ?? true
20012
+ };
20013
+ }
20014
+ var HANGUL_INITIALS = [0, 2, 3, 5, 6, 7, 9, 11, 12, 14, 15, 16, 17, 18];
20015
+ var HANGUL_MEDIALS = [0, 4, 8, 13, 18, 20];
20016
+ function hangulOrdinal(n) {
20017
+ const cols = HANGUL_INITIALS.length;
20018
+ const vowel = HANGUL_MEDIALS[Math.min(Math.floor(n / cols), HANGUL_MEDIALS.length - 1)];
20019
+ const init = HANGUL_INITIALS[n % cols];
20020
+ return String.fromCodePoint(44032 + init * 588 + vowel * 28);
20021
+ }
20022
+ function circledNumber(n) {
20023
+ return String.fromCodePoint(9312 + n % 20);
20024
+ }
20025
+ function circledHangul(n) {
20026
+ return String.fromCodePoint(12910 + n % 14);
20027
+ }
20028
+ var REPORT_BULLETS = ["\u25A1", "\u25CB", "-", "\u318D"];
20029
+ function standardMarker(depth, n) {
20030
+ switch (depth) {
20031
+ case 0:
20032
+ return `${n + 1}.`;
20033
+ case 1:
20034
+ return `${hangulOrdinal(n)}.`;
20035
+ case 2:
20036
+ return `${n + 1})`;
20037
+ case 3:
20038
+ return `${hangulOrdinal(n)})`;
20039
+ case 4:
20040
+ return `(${n + 1})`;
20041
+ case 5:
20042
+ return `(${hangulOrdinal(n)})`;
20043
+ case 6:
20044
+ return circledNumber(n);
20045
+ case 7:
20046
+ return circledHangul(n);
20047
+ default:
20048
+ return circledHangul(n);
20049
+ }
20050
+ }
20051
+ function reportMarker(depth) {
20052
+ return REPORT_BULLETS[Math.min(depth, REPORT_BULLETS.length - 1)];
20053
+ }
20054
+ function levelIndent(depth, bodyHeight, numbering) {
20055
+ const ta = bodyHeight / 2;
20056
+ const markerTa = numbering === "standard" && (depth === 4 || depth === 5) ? 3 : 2;
20057
+ const hang = Math.round((markerTa + 1) * ta);
20058
+ return { left: Math.round(depth * bodyHeight), indent: -hang };
20059
+ }
20060
+ function computeSuppression(depths) {
20061
+ const counts = /* @__PURE__ */ new Map();
20062
+ const keys = [];
20063
+ const path = [];
20064
+ for (const depth of depths) {
20065
+ path.length = depth + 1;
20066
+ path[depth] = (path[depth] ?? 0) + 1;
20067
+ const parentKey = path.slice(0, depth).join(".") + "|" + depth;
20068
+ keys.push(parentKey);
20069
+ counts.set(parentKey, (counts.get(parentKey) ?? 0) + 1);
20070
+ }
20071
+ return keys.map((k) => (counts.get(k) ?? 0) <= 1);
20072
+ }
20073
+ var GongmunNumberer = class {
20074
+ constructor(numbering) {
20075
+ this.numbering = numbering;
20076
+ }
20077
+ counts = [];
20078
+ /** depth 항목 하나에 대한 마커. suppress=true면 빈 문자열(부호 없음) */
20079
+ next(depth, suppress) {
20080
+ this.counts.length = depth + 1;
20081
+ const n = this.counts[depth] ?? 0;
20082
+ this.counts[depth] = n + 1;
20083
+ if (suppress) return "";
20084
+ return this.numbering === "report" ? reportMarker(depth) : standardMarker(depth, n);
20085
+ }
20086
+ reset() {
20087
+ this.counts = [];
20088
+ }
20089
+ };
20090
+ function mmToHwpunit(mm) {
20091
+ return Math.round(mm * 7200 / 25.4);
20092
+ }
20093
+
20094
+ // src/hwpx/generator.ts
19981
20095
  var NS_SECTION = "http://www.hancom.co.kr/hwpml/2011/section";
19982
20096
  var NS_PARA = "http://www.hancom.co.kr/hwpml/2011/paragraph";
19983
20097
  var NS_HEAD = "http://www.hancom.co.kr/hwpml/2011/head";
20098
+ var NS_CORE = "http://www.hancom.co.kr/hwpml/2011/core";
19984
20099
  var NS_OPF = "http://www.idpf.org/2007/opf/";
19985
20100
  var NS_HPF = "http://www.hancom.co.kr/schema/2011/hpf";
19986
20101
  var NS_OCF = "urn:oasis:names:tc:opendocument:xmlns:container";
@@ -20020,13 +20135,14 @@ function resolveTheme(theme) {
20020
20135
  }
20021
20136
  async function markdownToHwpx(markdown, options) {
20022
20137
  const theme = resolveTheme(options?.theme);
20138
+ const gongmun = options?.gongmun ? resolveGongmun(options.gongmun) : null;
20023
20139
  const blocks = parseMarkdownToBlocks(markdown);
20024
- const sectionXml = blocksToSectionXml(blocks, theme);
20140
+ const sectionXml = blocksToSectionXml(blocks, theme, gongmun);
20025
20141
  const zip = new JSZip6();
20026
20142
  zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
20027
20143
  zip.file("META-INF/container.xml", generateContainerXml());
20028
20144
  zip.file("Contents/content.hpf", generateManifest());
20029
- zip.file("Contents/header.xml", generateHeaderXml(theme));
20145
+ zip.file("Contents/header.xml", generateHeaderXml(theme, gongmun));
20030
20146
  zip.file("Contents/section0.xml", sectionXml);
20031
20147
  zip.file("Preview/PrvText.txt", buildPrvText(blocks));
20032
20148
  return await zip.generateAsync({ type: "arraybuffer" });
@@ -20219,25 +20335,95 @@ function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_C
20219
20335
  </hh:charPr>`;
20220
20336
  }
20221
20337
  function paraPr(id, opts = {}) {
20222
- const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0 } = opts;
20338
+ const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0, left = 0 } = opts;
20223
20339
  return ` <hh:paraPr id="${id}" tabPrIDRef="0" condense="0" fontLineHeight="0" snapToGrid="1" suppressLineNumbers="0" checked="0" textDir="AUTO">
20224
20340
  <hh:align horizontal="${align}" vertical="BASELINE"/>
20225
20341
  <hh:heading type="NONE" idRef="0" level="0"/>
20226
20342
  <hh:breakSetting breakLatinWord="KEEP_WORD" breakNonLatinWord="BREAK_WORD" widowOrphan="0" keepWithNext="0" keepLines="0" pageBreakBefore="0" lineWrap="BREAK"/>
20227
20343
  <hh:autoSpacing eAsianEng="0" eAsianNum="0"/>
20228
- <hh:margin indent="${indent}" left="0" right="0" prev="${spaceBefore}" next="${spaceAfter}"/>
20344
+ <hh:margin><hc:intent value="${indent}" unit="HWPUNIT"/><hc:left value="${left}" unit="HWPUNIT"/><hc:right value="0" unit="HWPUNIT"/><hc:prev value="${spaceBefore}" unit="HWPUNIT"/><hc:next value="${spaceAfter}" unit="HWPUNIT"/></hh:margin>
20229
20345
  <hh:lineSpacing type="PERCENT" value="${lineSpacing}"/>
20230
20346
  <hh:border borderFillIDRef="0" offsetLeft="0" offsetRight="0" offsetTop="0" offsetBottom="0" connect="0" ignoreMargin="0"/>
20231
20347
  </hh:paraPr>`;
20232
20348
  }
20233
- function generateHeaderXml(theme) {
20349
+ var GONGMUN_LIST_BASE = 8;
20350
+ var GONGMUN_LIST_LEVELS = 8;
20351
+ var GONGMUN_CENTER = GONGMUN_LIST_BASE + GONGMUN_LIST_LEVELS;
20352
+ function buildCharProperties(theme, gongmun) {
20353
+ let body = 1e3, code = 900, h1 = 1800, h2 = 1400, h3 = 1200, h4 = 1100;
20354
+ if (gongmun) {
20355
+ body = gongmun.bodyHeight;
20356
+ code = Math.max(body - 200, 900);
20357
+ h1 = gongmun.preset === "report" || gongmun.preset === "plan" ? 2e3 : 1700;
20358
+ h2 = 1600;
20359
+ h3 = body;
20360
+ h4 = Math.max(body - 100, 1300);
20361
+ }
20362
+ const rows = [
20363
+ charPr(0, body, false, false, 0, theme.body),
20364
+ charPr(1, body, true, false, 0, theme.body),
20365
+ charPr(2, body, false, true, 0, theme.body),
20366
+ charPr(3, body, true, true, 0, theme.body),
20367
+ charPr(4, code, false, false, 1),
20368
+ charPr(5, h1, true, false, 1, theme.h1),
20369
+ charPr(6, h2, true, false, 1, theme.h2),
20370
+ charPr(7, h3, true, false, 1, theme.h3),
20371
+ charPr(8, h4, true, false, 1, theme.h4),
20372
+ charPr(CHAR_TABLE_HEADER, body, theme.tableHeaderBold, false, 0, theme.tableHeader),
20373
+ charPr(CHAR_QUOTE, body, false, true, 0, theme.quote)
20374
+ ];
20375
+ return `<hh:charProperties itemCnt="${rows.length}">
20376
+ ${rows.join("\n")}
20377
+ </hh:charProperties>`;
20378
+ }
20379
+ function buildParaProperties(gongmun) {
20380
+ if (!gongmun) {
20381
+ const base2 = [
20382
+ paraPr(0),
20383
+ paraPr(1, { align: "LEFT", spaceBefore: 800, spaceAfter: 200, lineSpacing: 180 }),
20384
+ paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: 170 }),
20385
+ paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: 160 }),
20386
+ paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: 160 }),
20387
+ paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 }),
20388
+ paraPr(6, { align: "LEFT", lineSpacing: 150, indent: 600 }),
20389
+ paraPr(7, { align: "LEFT", lineSpacing: 160, indent: 600 })
20390
+ ];
20391
+ return `<hh:paraProperties itemCnt="${base2.length}">
20392
+ ${base2.join("\n")}
20393
+ </hh:paraProperties>`;
20394
+ }
20395
+ const ls = gongmun.lineSpacing;
20396
+ const titleAlign = gongmun.centerTitle ? "CENTER" : "LEFT";
20397
+ const base = [
20398
+ paraPr(0, { lineSpacing: ls }),
20399
+ paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls }),
20400
+ paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls }),
20401
+ paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls }),
20402
+ paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls }),
20403
+ paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 }),
20404
+ paraPr(6, { align: "LEFT", lineSpacing: ls, indent: 600 }),
20405
+ paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600 })
20406
+ ];
20407
+ for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
20408
+ const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering);
20409
+ base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent }));
20410
+ }
20411
+ base.push(paraPr(GONGMUN_CENTER, { align: "CENTER", lineSpacing: ls }));
20412
+ return `<hh:paraProperties itemCnt="${base.length}">
20413
+ ${base.join("\n")}
20414
+ </hh:paraProperties>`;
20415
+ }
20416
+ function generateHeaderXml(theme, gongmun) {
20417
+ const bodyFace = gongmun?.bodyFont === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5";
20418
+ const charPropsXml = buildCharProperties(theme, gongmun);
20419
+ const paraPropsXml = buildParaProperties(gongmun);
20234
20420
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
20235
- <hh:head xmlns:hh="${NS_HEAD}" xmlns:hp="${NS_PARA}" version="1.4" secCnt="1">
20421
+ <hh:head xmlns:hh="${NS_HEAD}" xmlns:hp="${NS_PARA}" xmlns:hc="${NS_CORE}" version="1.4" secCnt="1">
20236
20422
  <hh:beginNum page="1" footnote="1" endnote="1" pic="1" tbl="1" equation="1"/>
20237
20423
  <hh:refList>
20238
20424
  <hh:fontfaces itemCnt="7">
20239
20425
  <hh:fontface lang="HANGUL" fontCnt="3">
20240
- <hh:font id="0" face="\uD568\uCD08\uB86C\uBC14\uD0D5" type="TTF" isEmbedded="0">
20426
+ <hh:font id="0" face="${bodyFace}" type="TTF" isEmbedded="0">
20241
20427
  <hh:typeInfo familyType="FCAT_GOTHIC" weight="6" proportion="4" contrast="0" strokeVariation="1" armStyle="1" letterform="1" midline="1" xHeight="1"/>
20242
20428
  </hh:font>
20243
20429
  <hh:font id="1" face="\uD568\uCD08\uB86C\uB3CB\uC6C0" type="TTF" isEmbedded="0">
@@ -20306,32 +20492,11 @@ function generateHeaderXml(theme) {
20306
20492
  <hh:fillInfo/>
20307
20493
  </hh:borderFill>
20308
20494
  </hh:borderFills>
20309
- <hh:charProperties itemCnt="11">
20310
- ${charPr(0, 1e3, false, false, 0, theme.body)}
20311
- ${charPr(1, 1e3, true, false, 0, theme.body)}
20312
- ${charPr(2, 1e3, false, true, 0, theme.body)}
20313
- ${charPr(3, 1e3, true, true, 0, theme.body)}
20314
- ${charPr(4, 900, false, false, 1)}
20315
- ${charPr(5, 1800, true, false, 1, theme.h1)}
20316
- ${charPr(6, 1400, true, false, 1, theme.h2)}
20317
- ${charPr(7, 1200, true, false, 1, theme.h3)}
20318
- ${charPr(8, 1100, true, false, 1, theme.h4)}
20319
- ${charPr(CHAR_TABLE_HEADER, 1e3, theme.tableHeaderBold, false, 0, theme.tableHeader)}
20320
- ${charPr(CHAR_QUOTE, 1e3, false, true, 0, theme.quote)}
20321
- </hh:charProperties>
20495
+ ${charPropsXml}
20322
20496
  <hh:tabProperties itemCnt="0"/>
20323
20497
  <hh:numberings itemCnt="0"/>
20324
20498
  <hh:bullets itemCnt="0"/>
20325
- <hh:paraProperties itemCnt="8">
20326
- ${paraPr(0)}
20327
- ${paraPr(1, { align: "LEFT", spaceBefore: 800, spaceAfter: 200, lineSpacing: 180 })}
20328
- ${paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: 170 })}
20329
- ${paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: 160 })}
20330
- ${paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: 160 })}
20331
- ${paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 })}
20332
- ${paraPr(6, { align: "LEFT", lineSpacing: 150, indent: 600 })}
20333
- ${paraPr(7, { align: "LEFT", lineSpacing: 160, indent: 600 })}
20334
- </hh:paraProperties>
20499
+ ${paraPropsXml}
20335
20500
  <hh:styles itemCnt="1">
20336
20501
  <hh:style id="0" type="PARA" name="\uBC14\uD0D5\uAE00" engName="Normal" paraPrIDRef="0" charPrIDRef="0" nextStyleIDRef="0" langIDRef="1042" lockForm="0"/>
20337
20502
  </hh:styles>
@@ -20339,8 +20504,16 @@ ${paraPr(7, { align: "LEFT", lineSpacing: 160, indent: 600 })}
20339
20504
  <hh:compatibleDocument targetProgram="HWP2018"/>
20340
20505
  </hh:head>`;
20341
20506
  }
20342
- function generateSecPr() {
20343
- return `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="0" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="59528" height="84188" gutterType="LEFT_ONLY"><hp:margin header="2835" footer="2835" gutter="0" left="5670" right="4252" top="8504" bottom="4252"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
20507
+ function generateSecPr(gongmun) {
20508
+ const m = gongmun ? {
20509
+ top: mmToHwpunit(gongmun.margins.top),
20510
+ bottom: mmToHwpunit(gongmun.margins.bottom),
20511
+ left: mmToHwpunit(gongmun.margins.left),
20512
+ right: mmToHwpunit(gongmun.margins.right),
20513
+ header: 0,
20514
+ footer: 0
20515
+ } : { top: 8504, bottom: 4252, left: 5670, right: 4252, header: 2835, footer: 2835 };
20516
+ return `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="0" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="59528" height="84188" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
20344
20517
  }
20345
20518
  var TABLE_ID_BASE = 1e3;
20346
20519
  var tableIdCounter = TABLE_ID_BASE;
@@ -20371,12 +20544,37 @@ function generateTable(rows, theme) {
20371
20544
  const tbl = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="0" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="1" noShading="0">${tblInner}</hp:tbl>`;
20372
20545
  return `<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${tbl}</hp:run></hp:p>`;
20373
20546
  }
20374
- function blocksToSectionXml(blocks, theme) {
20547
+ function precomputeGongmunList(blocks, gongmun) {
20548
+ const result = /* @__PURE__ */ new Map();
20549
+ let i = 0;
20550
+ while (i < blocks.length) {
20551
+ if (blocks[i].type !== "list_item") {
20552
+ i++;
20553
+ continue;
20554
+ }
20555
+ const run = [];
20556
+ while (i < blocks.length && blocks[i].type === "list_item") {
20557
+ run.push(i);
20558
+ i++;
20559
+ }
20560
+ const depths = run.map((bi) => Math.min(Math.max(blocks[bi].indent || 0, 0), GONGMUN_LIST_LEVELS - 1));
20561
+ const suppress = gongmun.numbering === "standard" ? computeSuppression(depths) : depths.map(() => false);
20562
+ const numberer = new GongmunNumberer(gongmun.numbering);
20563
+ run.forEach((bi, k) => {
20564
+ const marker = numberer.next(depths[k], suppress[k]);
20565
+ result.set(bi, { marker, depth: depths[k] });
20566
+ });
20567
+ }
20568
+ return result;
20569
+ }
20570
+ function blocksToSectionXml(blocks, theme, gongmun) {
20375
20571
  const paraXmls = [];
20376
20572
  let isFirst = true;
20377
20573
  const orderedCounters = {};
20378
20574
  let prevWasOrdered = false;
20379
- for (const block of blocks) {
20575
+ const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
20576
+ for (let blockIdx = 0; blockIdx < blocks.length; blockIdx++) {
20577
+ const block = blocks[blockIdx];
20380
20578
  let xml = "";
20381
20579
  if (block.type !== "list_item" || !block.ordered) {
20382
20580
  if (prevWasOrdered) {
@@ -20391,9 +20589,15 @@ function blocksToSectionXml(blocks, theme) {
20391
20589
  xml = generateParagraph(block.text || "", pId, cId);
20392
20590
  break;
20393
20591
  }
20394
- case "paragraph":
20395
- xml = generateParagraph(block.text || "");
20592
+ case "paragraph": {
20593
+ const ctr = gongmun && /^<center>([\s\S]*)<\/center>$/i.exec((block.text || "").trim());
20594
+ if (ctr) {
20595
+ xml = generateParagraph(ctr[1].trim(), GONGMUN_CENTER);
20596
+ } else {
20597
+ xml = generateParagraph(block.text || "");
20598
+ }
20396
20599
  break;
20600
+ }
20397
20601
  case "code_block": {
20398
20602
  const codeLines = (block.text || "").split("\n");
20399
20603
  xml = codeLines.map((line) => generateParagraph(line || " ", PARA_CODE)).join("\n ");
@@ -20407,6 +20611,15 @@ function blocksToSectionXml(blocks, theme) {
20407
20611
  );
20408
20612
  break;
20409
20613
  case "list_item": {
20614
+ if (gongmun && gongmunList) {
20615
+ const info = gongmunList.get(blockIdx);
20616
+ const depth = info?.depth ?? 0;
20617
+ const marker2 = info?.marker ?? "";
20618
+ const content = block.text || "";
20619
+ const text = marker2 ? `${marker2} ${content}` : content;
20620
+ xml = generateParagraph(text, GONGMUN_LIST_BASE + depth);
20621
+ break;
20622
+ }
20410
20623
  const indent = block.indent || 0;
20411
20624
  let marker;
20412
20625
  if (block.ordered) {
@@ -20433,7 +20646,7 @@ function blocksToSectionXml(blocks, theme) {
20433
20646
  case "table":
20434
20647
  if (block.rows) {
20435
20648
  if (isFirst) {
20436
- const secRun = `<hp:run charPrIDRef="0">${generateSecPr()}<hp:t></hp:t></hp:run>`;
20649
+ const secRun = `<hp:run charPrIDRef="0">${generateSecPr(gongmun)}<hp:t></hp:t></hp:run>`;
20437
20650
  paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0">${secRun}</hp:p>`);
20438
20651
  isFirst = false;
20439
20652
  }
@@ -20445,14 +20658,14 @@ function blocksToSectionXml(blocks, theme) {
20445
20658
  if (isFirst && block.type !== "table") {
20446
20659
  xml = xml.replace(
20447
20660
  /<hp:run charPrIDRef="(\d+)">/,
20448
- `<hp:run charPrIDRef="$1">${generateSecPr()}`
20661
+ `<hp:run charPrIDRef="$1">${generateSecPr(gongmun)}`
20449
20662
  );
20450
20663
  isFirst = false;
20451
20664
  }
20452
20665
  paraXmls.push(xml);
20453
20666
  }
20454
20667
  if (paraXmls.length === 0) {
20455
- paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${generateSecPr()}<hp:t></hp:t></hp:run></hp:p>`);
20668
+ paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${generateSecPr(gongmun)}<hp:t></hp:t></hp:run></hp:p>`);
20456
20669
  }
20457
20670
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
20458
20671
  <hs:sec xmlns:hs="${NS_SECTION}" xmlns:hp="${NS_PARA}">
@@ -21248,6 +21461,7 @@ async function patchHwpx(original, editedMarkdown, options) {
21248
21461
  try {
21249
21462
  for (let i = 0; i < scans.length; i++) {
21250
21463
  if (sectionSplices[i].length === 0) continue;
21464
+ sectionSplices[i].push(...allLinesegRemovalSplices(scans[i].xml));
21251
21465
  const newXml = applySplices(scans[i].xml, sectionSplices[i]);
21252
21466
  replacements.set(sectionPaths[i], encoder.encode(newXml));
21253
21467
  }
@@ -22965,7 +23179,7 @@ async function parseHwp(buffer, options) {
22965
23179
  async function parsePdf(buffer, options) {
22966
23180
  let parsePdfDocument;
22967
23181
  try {
22968
- const mod = await import("./parser-QTJL6IQY.js");
23182
+ const mod = await import("./parser-ZWGQCMRS.js");
22969
23183
  parsePdfDocument = mod.parsePdfDocument;
22970
23184
  } catch {
22971
23185
  return {