kordoc 2.7.2 → 2.9.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 +20 -1
- package/dist/{chunk-4NWDJGAU.js → chunk-M24KMDAR.js} +53 -26
- package/dist/chunk-M24KMDAR.js.map +1 -0
- package/dist/{chunk-Y476BOHI.cjs → chunk-QB7CS534.cjs} +2 -2
- package/dist/{chunk-Y476BOHI.cjs.map → chunk-QB7CS534.cjs.map} +1 -1
- package/dist/{chunk-LB7E2KDF.js → chunk-RXZLTACX.js} +2 -2
- package/dist/{chunk-4SK2PDMQ.js.map → chunk-RXZLTACX.js.map} +1 -1
- package/dist/{chunk-4SK2PDMQ.js → chunk-SJ5TPMBT.js} +2 -2
- package/dist/{chunk-LB7E2KDF.js.map → chunk-SJ5TPMBT.js.map} +1 -1
- package/dist/cli.js +3 -3
- package/dist/index.cjs +162 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -2
- package/dist/index.d.ts +56 -2
- package/dist/index.js +52 -25
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +3 -3
- package/dist/{parser-7OFQ67QL.cjs → parser-EL5YETUA.cjs} +158 -18
- package/dist/parser-EL5YETUA.cjs.map +1 -0
- package/dist/{parser-DJCMY3OO.js → parser-OMPBVEFU.js} +145 -5
- package/dist/parser-OMPBVEFU.js.map +1 -0
- package/dist/{parser-QMMQ7Y7R.js → parser-XBYGROQB.js} +145 -5
- package/dist/parser-XBYGROQB.js.map +1 -0
- package/dist/{watch-FVMVIZ5Q.js → watch-ULLLK7ID.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-4NWDJGAU.js.map +0 -1
- package/dist/parser-7OFQ67QL.cjs.map +0 -1
- package/dist/parser-DJCMY3OO.js.map +0 -1
- package/dist/parser-QMMQ7Y7R.js.map +0 -1
- /package/dist/{watch-FVMVIZ5Q.js.map → watch-ULLLK7ID.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -164,6 +164,34 @@ interface ParseSuccess extends ParseResultBase {
|
|
|
164
164
|
warnings?: ParseWarning[];
|
|
165
165
|
/** 추출된 이미지 목록 — 마크다운에서 파일명으로 참조됨 */
|
|
166
166
|
images?: ExtractedImage[];
|
|
167
|
+
/** 페이지별 텍스트 품질 신호 — PDF에서만 제공 */
|
|
168
|
+
pageQuality?: PageQuality[];
|
|
169
|
+
/** 문서 단위 품질 요약 — PDF에서만 제공 */
|
|
170
|
+
qualitySummary?: DocumentQualitySummary;
|
|
171
|
+
}
|
|
172
|
+
/** 페이지별 텍스트 품질 신호 (PDF 전용). 자세한 설명은 src/pdf/quality.ts */
|
|
173
|
+
interface PageQuality {
|
|
174
|
+
page: number;
|
|
175
|
+
textChars: number;
|
|
176
|
+
hangulRatio: number;
|
|
177
|
+
controlCharRatio: number;
|
|
178
|
+
replacementCharRatio: number;
|
|
179
|
+
puaRatio: number;
|
|
180
|
+
needsOcr: boolean;
|
|
181
|
+
ocrReason?: "low_text" | "high_pua" | "high_control" | "high_replacement";
|
|
182
|
+
}
|
|
183
|
+
/** 문서 단위 품질 요약 (PDF 전용). */
|
|
184
|
+
interface DocumentQualitySummary {
|
|
185
|
+
totalPages: number;
|
|
186
|
+
totalTextChars: number;
|
|
187
|
+
avgHangulRatio: number;
|
|
188
|
+
avgControlCharRatio: number;
|
|
189
|
+
avgReplacementCharRatio: number;
|
|
190
|
+
avgPuaRatio: number;
|
|
191
|
+
lowTextPageCount: number;
|
|
192
|
+
highPuaPageCount: number;
|
|
193
|
+
needsOcr: boolean;
|
|
194
|
+
ocrCandidatePages: number[];
|
|
167
195
|
}
|
|
168
196
|
/** 추출된 이미지 — ParseSuccess.images에 포함 */
|
|
169
197
|
interface ExtractedImage {
|
|
@@ -315,10 +343,36 @@ declare function fillHwpx(hwpxBuffer: ArrayBuffer, values: Record<string, string
|
|
|
315
343
|
* 순서/비순서 리스트, 수평선, 인용문, 테이블
|
|
316
344
|
* jszip으로 HWPX ZIP 패키징.
|
|
317
345
|
*/
|
|
346
|
+
/** HWPX 생성 시 적용할 시각 테마 (모두 선택) */
|
|
347
|
+
interface HwpxTheme {
|
|
348
|
+
/**
|
|
349
|
+
* 헤딩 레벨별 텍스트 색상. 미지정 시 검정.
|
|
350
|
+
* 현재 charPr 매핑은 h1/h2/h3/h4 4단계 (h5, h6은 h4와 같은 charPr 공유)이므로
|
|
351
|
+
* 키는 1~4만 받는다.
|
|
352
|
+
*/
|
|
353
|
+
headingColors?: Partial<Record<1 | 2 | 3 | 4, string>>;
|
|
354
|
+
/** 본문 단락 텍스트 색상. 미지정 시 검정 */
|
|
355
|
+
bodyColor?: string;
|
|
356
|
+
/**
|
|
357
|
+
* 인용문 텍스트 색상. 미지정 시 검정.
|
|
358
|
+
*
|
|
359
|
+
* 주의: 이 옵션을 지정하면 인용문이 별도 charPr(이탤릭)로 렌더링된다.
|
|
360
|
+
* 미지정 시 기존 동작 그대로 본문 charPr로 렌더링 (이탤릭 아님).
|
|
361
|
+
*/
|
|
362
|
+
quoteColor?: string;
|
|
363
|
+
/** 표 첫 행 텍스트 색상. 미지정 시 본문과 동일 */
|
|
364
|
+
tableHeaderColor?: string;
|
|
365
|
+
/** 표 첫 행 텍스트를 굵게 표시 (기본 false) */
|
|
366
|
+
tableHeaderBold?: boolean;
|
|
367
|
+
}
|
|
368
|
+
/** markdownToHwpx 옵션 */
|
|
369
|
+
interface MarkdownToHwpxOptions {
|
|
370
|
+
theme?: HwpxTheme;
|
|
371
|
+
}
|
|
318
372
|
/**
|
|
319
373
|
* 마크다운 텍스트를 HWPX (ArrayBuffer)로 변환.
|
|
320
374
|
*/
|
|
321
|
-
declare function markdownToHwpx(markdown: string): Promise<ArrayBuffer>;
|
|
375
|
+
declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOptions): Promise<ArrayBuffer>;
|
|
322
376
|
|
|
323
377
|
/**
|
|
324
378
|
* Print Renderer — Markdown / IRBlock[] → PDF (puppeteer-core 기반).
|
|
@@ -465,4 +519,4 @@ interface FillFormOutput {
|
|
|
465
519
|
*/
|
|
466
520
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, string>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
467
521
|
|
|
468
|
-
export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormResult, type HwpxFillResult, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type OcrProvider, type OutlineItem, type PageMargin, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PrintOptions, type PrintPreset, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, blocksToPdf, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, fillForm, fillFormFields, fillHwpx, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, renderHtml };
|
|
522
|
+
export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormResult, type HwpxFillResult, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PrintOptions, type PrintPreset, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, blocksToPdf, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, fillForm, fillFormFields, fillHwpx, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, renderHtml };
|
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,34 @@ interface ParseSuccess extends ParseResultBase {
|
|
|
164
164
|
warnings?: ParseWarning[];
|
|
165
165
|
/** 추출된 이미지 목록 — 마크다운에서 파일명으로 참조됨 */
|
|
166
166
|
images?: ExtractedImage[];
|
|
167
|
+
/** 페이지별 텍스트 품질 신호 — PDF에서만 제공 */
|
|
168
|
+
pageQuality?: PageQuality[];
|
|
169
|
+
/** 문서 단위 품질 요약 — PDF에서만 제공 */
|
|
170
|
+
qualitySummary?: DocumentQualitySummary;
|
|
171
|
+
}
|
|
172
|
+
/** 페이지별 텍스트 품질 신호 (PDF 전용). 자세한 설명은 src/pdf/quality.ts */
|
|
173
|
+
interface PageQuality {
|
|
174
|
+
page: number;
|
|
175
|
+
textChars: number;
|
|
176
|
+
hangulRatio: number;
|
|
177
|
+
controlCharRatio: number;
|
|
178
|
+
replacementCharRatio: number;
|
|
179
|
+
puaRatio: number;
|
|
180
|
+
needsOcr: boolean;
|
|
181
|
+
ocrReason?: "low_text" | "high_pua" | "high_control" | "high_replacement";
|
|
182
|
+
}
|
|
183
|
+
/** 문서 단위 품질 요약 (PDF 전용). */
|
|
184
|
+
interface DocumentQualitySummary {
|
|
185
|
+
totalPages: number;
|
|
186
|
+
totalTextChars: number;
|
|
187
|
+
avgHangulRatio: number;
|
|
188
|
+
avgControlCharRatio: number;
|
|
189
|
+
avgReplacementCharRatio: number;
|
|
190
|
+
avgPuaRatio: number;
|
|
191
|
+
lowTextPageCount: number;
|
|
192
|
+
highPuaPageCount: number;
|
|
193
|
+
needsOcr: boolean;
|
|
194
|
+
ocrCandidatePages: number[];
|
|
167
195
|
}
|
|
168
196
|
/** 추출된 이미지 — ParseSuccess.images에 포함 */
|
|
169
197
|
interface ExtractedImage {
|
|
@@ -315,10 +343,36 @@ declare function fillHwpx(hwpxBuffer: ArrayBuffer, values: Record<string, string
|
|
|
315
343
|
* 순서/비순서 리스트, 수평선, 인용문, 테이블
|
|
316
344
|
* jszip으로 HWPX ZIP 패키징.
|
|
317
345
|
*/
|
|
346
|
+
/** HWPX 생성 시 적용할 시각 테마 (모두 선택) */
|
|
347
|
+
interface HwpxTheme {
|
|
348
|
+
/**
|
|
349
|
+
* 헤딩 레벨별 텍스트 색상. 미지정 시 검정.
|
|
350
|
+
* 현재 charPr 매핑은 h1/h2/h3/h4 4단계 (h5, h6은 h4와 같은 charPr 공유)이므로
|
|
351
|
+
* 키는 1~4만 받는다.
|
|
352
|
+
*/
|
|
353
|
+
headingColors?: Partial<Record<1 | 2 | 3 | 4, string>>;
|
|
354
|
+
/** 본문 단락 텍스트 색상. 미지정 시 검정 */
|
|
355
|
+
bodyColor?: string;
|
|
356
|
+
/**
|
|
357
|
+
* 인용문 텍스트 색상. 미지정 시 검정.
|
|
358
|
+
*
|
|
359
|
+
* 주의: 이 옵션을 지정하면 인용문이 별도 charPr(이탤릭)로 렌더링된다.
|
|
360
|
+
* 미지정 시 기존 동작 그대로 본문 charPr로 렌더링 (이탤릭 아님).
|
|
361
|
+
*/
|
|
362
|
+
quoteColor?: string;
|
|
363
|
+
/** 표 첫 행 텍스트 색상. 미지정 시 본문과 동일 */
|
|
364
|
+
tableHeaderColor?: string;
|
|
365
|
+
/** 표 첫 행 텍스트를 굵게 표시 (기본 false) */
|
|
366
|
+
tableHeaderBold?: boolean;
|
|
367
|
+
}
|
|
368
|
+
/** markdownToHwpx 옵션 */
|
|
369
|
+
interface MarkdownToHwpxOptions {
|
|
370
|
+
theme?: HwpxTheme;
|
|
371
|
+
}
|
|
318
372
|
/**
|
|
319
373
|
* 마크다운 텍스트를 HWPX (ArrayBuffer)로 변환.
|
|
320
374
|
*/
|
|
321
|
-
declare function markdownToHwpx(markdown: string): Promise<ArrayBuffer>;
|
|
375
|
+
declare function markdownToHwpx(markdown: string, options?: MarkdownToHwpxOptions): Promise<ArrayBuffer>;
|
|
322
376
|
|
|
323
377
|
/**
|
|
324
378
|
* Print Renderer — Markdown / IRBlock[] → PDF (puppeteer-core 기반).
|
|
@@ -465,4 +519,4 @@ interface FillFormOutput {
|
|
|
465
519
|
*/
|
|
466
520
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, string>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
467
521
|
|
|
468
|
-
export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormResult, type HwpxFillResult, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type OcrProvider, type OutlineItem, type PageMargin, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PrintOptions, type PrintPreset, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, blocksToPdf, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, fillForm, fillFormFields, fillHwpx, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, renderHtml };
|
|
522
|
+
export { type BlockDiff, type BoundingBox, type CellContext, type CellDiff, type DiffChangeType, type DiffResult, type DocumentMetadata, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillOutputFormat, type FillResult, type FormField, type FormResult, type HwpxFillResult, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type OcrProvider, type OutlineItem, type PageMargin, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PrintOptions, type PrintPreset, VERSION, type WarningCode, type WatchOptions, blocksToMarkdown, blocksToPdf, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, fillForm, fillFormFields, fillHwpx, isHwpxFile, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, markdownToHwpx, markdownToPdf, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, renderHtml };
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
sanitizeHref,
|
|
17
17
|
stripDtd,
|
|
18
18
|
toArrayBuffer
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RXZLTACX.js";
|
|
20
20
|
import {
|
|
21
21
|
parsePageRange
|
|
22
22
|
} from "./chunk-SBVRCJFH.js";
|
|
@@ -18397,6 +18397,8 @@ var CHAR_H1 = 5;
|
|
|
18397
18397
|
var CHAR_H2 = 6;
|
|
18398
18398
|
var CHAR_H3 = 7;
|
|
18399
18399
|
var CHAR_H4 = 8;
|
|
18400
|
+
var CHAR_TABLE_HEADER = 9;
|
|
18401
|
+
var CHAR_QUOTE = 10;
|
|
18400
18402
|
var PARA_NORMAL = 0;
|
|
18401
18403
|
var PARA_H1 = 1;
|
|
18402
18404
|
var PARA_H2 = 2;
|
|
@@ -18405,14 +18407,30 @@ var PARA_H4 = 4;
|
|
|
18405
18407
|
var PARA_CODE = 5;
|
|
18406
18408
|
var PARA_QUOTE = 6;
|
|
18407
18409
|
var PARA_LIST = 7;
|
|
18408
|
-
|
|
18410
|
+
var DEFAULT_TEXT_COLOR = "#000000";
|
|
18411
|
+
function resolveTheme(theme) {
|
|
18412
|
+
return {
|
|
18413
|
+
h1: theme?.headingColors?.[1] ?? DEFAULT_TEXT_COLOR,
|
|
18414
|
+
h2: theme?.headingColors?.[2] ?? DEFAULT_TEXT_COLOR,
|
|
18415
|
+
h3: theme?.headingColors?.[3] ?? DEFAULT_TEXT_COLOR,
|
|
18416
|
+
h4: theme?.headingColors?.[4] ?? theme?.headingColors?.[3] ?? DEFAULT_TEXT_COLOR,
|
|
18417
|
+
body: theme?.bodyColor ?? DEFAULT_TEXT_COLOR,
|
|
18418
|
+
quote: theme?.quoteColor ?? DEFAULT_TEXT_COLOR,
|
|
18419
|
+
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
18420
|
+
hasQuoteOption: theme?.quoteColor !== void 0,
|
|
18421
|
+
tableHeader: theme?.tableHeaderColor ?? theme?.bodyColor ?? DEFAULT_TEXT_COLOR,
|
|
18422
|
+
tableHeaderBold: !!theme?.tableHeaderBold
|
|
18423
|
+
};
|
|
18424
|
+
}
|
|
18425
|
+
async function markdownToHwpx(markdown, options) {
|
|
18426
|
+
const theme = resolveTheme(options?.theme);
|
|
18409
18427
|
const blocks = parseMarkdownToBlocks(markdown);
|
|
18410
|
-
const sectionXml = blocksToSectionXml(blocks);
|
|
18428
|
+
const sectionXml = blocksToSectionXml(blocks, theme);
|
|
18411
18429
|
const zip = new JSZip6();
|
|
18412
18430
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
18413
18431
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
18414
18432
|
zip.file("Contents/content.hpf", generateManifest());
|
|
18415
|
-
zip.file("Contents/header.xml", generateHeaderXml());
|
|
18433
|
+
zip.file("Contents/header.xml", generateHeaderXml(theme));
|
|
18416
18434
|
zip.file("Contents/section0.xml", sectionXml);
|
|
18417
18435
|
zip.file("Preview/PrvText.txt", buildPrvText(blocks));
|
|
18418
18436
|
return await zip.generateAsync({ type: "arraybuffer" });
|
|
@@ -18592,11 +18610,11 @@ function generateManifest() {
|
|
|
18592
18610
|
</opf:spine>
|
|
18593
18611
|
</opf:package>`;
|
|
18594
18612
|
}
|
|
18595
|
-
function charPr(id, height, bold, italic, fontId = 0) {
|
|
18613
|
+
function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_COLOR) {
|
|
18596
18614
|
const boldAttr = bold ? ` bold="1"` : "";
|
|
18597
18615
|
const italicAttr = italic ? ` italic="1"` : "";
|
|
18598
18616
|
const effFont = bold ? 2 : fontId;
|
|
18599
|
-
return ` <hh:charPr id="${id}" height="${height}" textColor="
|
|
18617
|
+
return ` <hh:charPr id="${id}" height="${height}" textColor="${textColor}" shadeColor="none" useFontSpace="0" useKerning="0" symMark="NONE" borderFillIDRef="0"${boldAttr}${italicAttr}>
|
|
18600
18618
|
<hh:fontRef hangul="${effFont}" latin="${effFont}" hanja="${effFont}" japanese="${effFont}" other="${effFont}" symbol="${effFont}" user="${effFont}"/>
|
|
18601
18619
|
<hh:ratio hangul="100" latin="100" hanja="100" japanese="100" other="100" symbol="100" user="100"/>
|
|
18602
18620
|
<hh:spacing hangul="0" latin="0" hanja="0" japanese="0" other="0" symbol="0" user="0"/>
|
|
@@ -18616,7 +18634,7 @@ function paraPr(id, opts = {}) {
|
|
|
18616
18634
|
<hh:border borderFillIDRef="0" offsetLeft="0" offsetRight="0" offsetTop="0" offsetBottom="0" connect="0" ignoreMargin="0"/>
|
|
18617
18635
|
</hh:paraPr>`;
|
|
18618
18636
|
}
|
|
18619
|
-
function generateHeaderXml() {
|
|
18637
|
+
function generateHeaderXml(theme) {
|
|
18620
18638
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
18621
18639
|
<hh:head xmlns:hh="${NS_HEAD}" xmlns:hp="${NS_PARA}" version="1.4" secCnt="1">
|
|
18622
18640
|
<hh:beginNum page="1" footnote="1" endnote="1" pic="1" tbl="1" equation="1"/>
|
|
@@ -18692,16 +18710,18 @@ function generateHeaderXml() {
|
|
|
18692
18710
|
<hh:fillInfo/>
|
|
18693
18711
|
</hh:borderFill>
|
|
18694
18712
|
</hh:borderFills>
|
|
18695
|
-
<hh:charProperties itemCnt="
|
|
18696
|
-
${charPr(0, 1e3, false, false)}
|
|
18697
|
-
${charPr(1, 1e3, true, false)}
|
|
18698
|
-
${charPr(2, 1e3, false, true)}
|
|
18699
|
-
${charPr(3, 1e3, true, true)}
|
|
18713
|
+
<hh:charProperties itemCnt="11">
|
|
18714
|
+
${charPr(0, 1e3, false, false, 0, theme.body)}
|
|
18715
|
+
${charPr(1, 1e3, true, false, 0, theme.body)}
|
|
18716
|
+
${charPr(2, 1e3, false, true, 0, theme.body)}
|
|
18717
|
+
${charPr(3, 1e3, true, true, 0, theme.body)}
|
|
18700
18718
|
${charPr(4, 900, false, false, 1)}
|
|
18701
|
-
${charPr(5, 1800, true, false, 1)}
|
|
18702
|
-
${charPr(6, 1400, true, false, 1)}
|
|
18703
|
-
${charPr(7, 1200, true, false, 1)}
|
|
18704
|
-
${charPr(8, 1100, true, false, 1)}
|
|
18719
|
+
${charPr(5, 1800, true, false, 1, theme.h1)}
|
|
18720
|
+
${charPr(6, 1400, true, false, 1, theme.h2)}
|
|
18721
|
+
${charPr(7, 1200, true, false, 1, theme.h3)}
|
|
18722
|
+
${charPr(8, 1100, true, false, 1, theme.h4)}
|
|
18723
|
+
${charPr(CHAR_TABLE_HEADER, 1e3, theme.tableHeaderBold, false, 0, theme.tableHeader)}
|
|
18724
|
+
${charPr(CHAR_QUOTE, 1e3, false, true, 0, theme.quote)}
|
|
18705
18725
|
</hh:charProperties>
|
|
18706
18726
|
<hh:tabProperties itemCnt="0"/>
|
|
18707
18727
|
<hh:numberings itemCnt="0"/>
|
|
@@ -18731,7 +18751,7 @@ var tableIdCounter = TABLE_ID_BASE;
|
|
|
18731
18751
|
function nextTableId() {
|
|
18732
18752
|
return ++tableIdCounter;
|
|
18733
18753
|
}
|
|
18734
|
-
function generateTable(rows) {
|
|
18754
|
+
function generateTable(rows, theme) {
|
|
18735
18755
|
const rowCnt = rows.length;
|
|
18736
18756
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
18737
18757
|
const cellW = Math.floor(44e3 / colCnt);
|
|
@@ -18739,12 +18759,15 @@ function generateTable(rows) {
|
|
|
18739
18759
|
const tblW = cellW * colCnt;
|
|
18740
18760
|
const tblH = cellH * rowCnt;
|
|
18741
18761
|
const tblId = nextTableId();
|
|
18762
|
+
const useHeaderStyle = theme.tableHeader !== theme.body || theme.tableHeaderBold;
|
|
18742
18763
|
const trElements = rows.map((row, rowIdx) => {
|
|
18743
18764
|
const cells = row.length < colCnt ? [...row, ...Array(colCnt - row.length).fill("")] : row;
|
|
18765
|
+
const isHeaderRow = rowIdx === 0;
|
|
18766
|
+
const headerCharPr = isHeaderRow && useHeaderStyle ? CHAR_TABLE_HEADER : CHAR_NORMAL;
|
|
18744
18767
|
const tdElements = cells.map((cell, colIdx) => {
|
|
18745
|
-
const runs = generateRuns(cell);
|
|
18768
|
+
const runs = generateRuns(cell, headerCharPr);
|
|
18746
18769
|
const p = `<hp:p paraPrIDRef="0" styleIDRef="0">${runs}</hp:p>`;
|
|
18747
|
-
return `<hp:tc name="" header="${
|
|
18770
|
+
return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="1"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="TOP" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${p}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${cellW}" height="${cellH}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
|
|
18748
18771
|
}).join("");
|
|
18749
18772
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
18750
18773
|
}).join("");
|
|
@@ -18752,7 +18775,7 @@ function generateTable(rows) {
|
|
|
18752
18775
|
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>`;
|
|
18753
18776
|
return `<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${tbl}</hp:run></hp:p>`;
|
|
18754
18777
|
}
|
|
18755
|
-
function blocksToSectionXml(blocks) {
|
|
18778
|
+
function blocksToSectionXml(blocks, theme) {
|
|
18756
18779
|
const paraXmls = [];
|
|
18757
18780
|
let isFirst = true;
|
|
18758
18781
|
const orderedCounters = {};
|
|
@@ -18781,7 +18804,11 @@ function blocksToSectionXml(blocks) {
|
|
|
18781
18804
|
break;
|
|
18782
18805
|
}
|
|
18783
18806
|
case "blockquote":
|
|
18784
|
-
xml = generateParagraph(
|
|
18807
|
+
xml = generateParagraph(
|
|
18808
|
+
block.text || "",
|
|
18809
|
+
PARA_QUOTE,
|
|
18810
|
+
theme.hasQuoteOption ? CHAR_QUOTE : CHAR_NORMAL
|
|
18811
|
+
);
|
|
18785
18812
|
break;
|
|
18786
18813
|
case "list_item": {
|
|
18787
18814
|
const indent = block.indent || 0;
|
|
@@ -18814,7 +18841,7 @@ function blocksToSectionXml(blocks) {
|
|
|
18814
18841
|
paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0">${secRun}</hp:p>`);
|
|
18815
18842
|
isFirst = false;
|
|
18816
18843
|
}
|
|
18817
|
-
xml = generateTable(block.rows);
|
|
18844
|
+
xml = generateTable(block.rows, theme);
|
|
18818
18845
|
}
|
|
18819
18846
|
break;
|
|
18820
18847
|
}
|
|
@@ -19254,7 +19281,7 @@ async function parseHwp(buffer, options) {
|
|
|
19254
19281
|
async function parsePdf(buffer, options) {
|
|
19255
19282
|
let parsePdfDocument;
|
|
19256
19283
|
try {
|
|
19257
|
-
const mod = await import("./parser-
|
|
19284
|
+
const mod = await import("./parser-OMPBVEFU.js");
|
|
19258
19285
|
parsePdfDocument = mod.parsePdfDocument;
|
|
19259
19286
|
} catch {
|
|
19260
19287
|
return {
|
|
@@ -19265,8 +19292,8 @@ async function parsePdf(buffer, options) {
|
|
|
19265
19292
|
};
|
|
19266
19293
|
}
|
|
19267
19294
|
try {
|
|
19268
|
-
const { markdown, blocks, metadata, outline, warnings, isImageBased } = await parsePdfDocument(buffer, options);
|
|
19269
|
-
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased };
|
|
19295
|
+
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary } = await parsePdfDocument(buffer, options);
|
|
19296
|
+
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
|
|
19270
19297
|
} catch (err) {
|
|
19271
19298
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
19272
19299
|
return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: classifyError(err), isImageBased };
|