kordoc 2.2.0 → 2.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.
- package/LICENSE +21 -21
- package/README.md +318 -302
- package/dist/{chunk-MOL7MDBG.js → chunk-3TBUDJDE.js} +1 -1
- package/dist/chunk-3TBUDJDE.js.map +1 -0
- package/dist/{chunk-LYFG7AUT.js → chunk-FINXMRCH.js} +15 -12
- package/dist/chunk-FINXMRCH.js.map +1 -0
- package/dist/{chunk-5Y2Q3BRW.js → chunk-MUAWCQDY.js} +1 -1
- package/dist/chunk-MUAWCQDY.js.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/{detect-GYK3HKD5.js → detect-63IGCXTH.js} +2 -2
- package/dist/index.cjs +11 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +4 -4
- package/dist/mcp.js.map +1 -1
- package/dist/page-range-OF5I4PQY.js +8 -0
- package/dist/{watch-Q5OXA73S.js → watch-Q6L4UBTC.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-5Y2Q3BRW.js.map +0 -1
- package/dist/chunk-LYFG7AUT.js.map +0 -1
- package/dist/chunk-MOL7MDBG.js.map +0 -1
- package/dist/page-range-737B4EZW.js +0 -8
- /package/dist/{detect-GYK3HKD5.js.map → detect-63IGCXTH.js.map} +0 -0
- /package/dist/{page-range-737B4EZW.js.map → page-range-OF5I4PQY.js.map} +0 -0
- /package/dist/{watch-Q5OXA73S.js.map → watch-Q6L4UBTC.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -139,7 +139,7 @@ import { inflateRawSync } from "zlib";
|
|
|
139
139
|
import { DOMParser } from "@xmldom/xmldom";
|
|
140
140
|
|
|
141
141
|
// src/utils.ts
|
|
142
|
-
var VERSION = true ? "2.2.
|
|
142
|
+
var VERSION = true ? "2.2.1" : "0.0.0-dev";
|
|
143
143
|
function toArrayBuffer(buf) {
|
|
144
144
|
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
|
145
145
|
return buf.buffer;
|
|
@@ -328,9 +328,12 @@ function trimAndReturn(grid, numRows, maxCols) {
|
|
|
328
328
|
}
|
|
329
329
|
function convertTableToText(rows) {
|
|
330
330
|
return rows.map(
|
|
331
|
-
(row) => row.map((c) => c.text.trim().replace(/\n/g, " ")).filter(Boolean).join("
|
|
331
|
+
(row) => row.map((c) => c.text.trim().replace(/\n/g, " ").replace(/\|/g, "\\|")).filter(Boolean).join(" / ")
|
|
332
332
|
).filter(Boolean).join("\n");
|
|
333
333
|
}
|
|
334
|
+
function escapeGfm(text) {
|
|
335
|
+
return text.replace(/~/g, "\\~");
|
|
336
|
+
}
|
|
334
337
|
var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
|
|
335
338
|
function sanitizeText(text) {
|
|
336
339
|
let result = text.replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
@@ -440,7 +443,7 @@ function blocksToMarkdown(blocks) {
|
|
|
440
443
|
if (block.footnoteText) {
|
|
441
444
|
text += ` (\uC8FC: ${block.footnoteText})`;
|
|
442
445
|
}
|
|
443
|
-
lines.push(text);
|
|
446
|
+
lines.push(escapeGfm(text), "");
|
|
444
447
|
} else if (block.type === "table" && block.table) {
|
|
445
448
|
if (lines.length > 0 && lines[lines.length - 1] !== "") {
|
|
446
449
|
lines.push("");
|
|
@@ -463,13 +466,13 @@ function tableToMarkdown(table) {
|
|
|
463
466
|
return content.split(/\n/).map((line) => {
|
|
464
467
|
const trimmed = line.trim();
|
|
465
468
|
if (!trimmed) return "";
|
|
466
|
-
if (/^\d+\.\s/.test(trimmed)) return `**${trimmed}**`;
|
|
467
|
-
if (/^[가-힣]\.\s/.test(trimmed)) return ` ${trimmed}`;
|
|
468
|
-
return trimmed;
|
|
469
|
+
if (/^\d+\.\s/.test(trimmed)) return `**${escapeGfm(trimmed)}**`;
|
|
470
|
+
if (/^[가-힣]\.\s/.test(trimmed)) return ` ${escapeGfm(trimmed)}`;
|
|
471
|
+
return escapeGfm(trimmed);
|
|
469
472
|
}).filter(Boolean).join("\n");
|
|
470
473
|
}
|
|
471
474
|
if (numCols === 1 && numRows >= 2) {
|
|
472
|
-
return cells.map((row) => sanitizeText(row[0].text).replace(/\n/g, " ")).filter(Boolean).join("\n");
|
|
475
|
+
return cells.map((row) => escapeGfm(sanitizeText(row[0].text)).replace(/\n/g, " ")).filter(Boolean).join("\n");
|
|
473
476
|
}
|
|
474
477
|
const display = Array.from({ length: numRows }, () => Array(numCols).fill(""));
|
|
475
478
|
const skip = /* @__PURE__ */ new Set();
|
|
@@ -478,7 +481,7 @@ function tableToMarkdown(table) {
|
|
|
478
481
|
if (skip.has(`${r},${c}`)) continue;
|
|
479
482
|
const cell = cells[r]?.[c];
|
|
480
483
|
if (!cell) continue;
|
|
481
|
-
display[r][c] = sanitizeText(cell.text).replace(/\n/g, "<br>");
|
|
484
|
+
display[r][c] = escapeGfm(sanitizeText(cell.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>");
|
|
482
485
|
for (let dr = 0; dr < cell.rowSpan; dr++) {
|
|
483
486
|
for (let dc = 0; dc < cell.colSpan; dc++) {
|
|
484
487
|
if (dr === 0 && dc === 0) continue;
|