kordoc 3.11.0 → 3.12.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 +6 -0
- package/dist/{-QMW2GDWP.js → -OPZIF3QT.js} +5 -5
- package/dist/{chunk-RCSDSN5Y.cjs → chunk-2C5GCXPJ.cjs} +2 -2
- package/dist/{chunk-RCSDSN5Y.cjs.map → chunk-2C5GCXPJ.cjs.map} +1 -1
- package/dist/{chunk-SNSAZ7FA.js → chunk-7Z43WEML.js} +2 -2
- package/dist/{chunk-O27B5IRL.js → chunk-BUDM6ULT.js} +2 -2
- package/dist/{chunk-GETZFABK.js → chunk-ILR7GF3W.js} +2 -2
- package/dist/{chunk-D4JKKSSI.js → chunk-NGKIAZ6G.js} +2 -2
- package/dist/{chunk-TUBD3EEF.js → chunk-RUYSNNYZ.js} +5 -5
- package/dist/cli.js +7 -7
- package/dist/index.cjs +118 -118
- package/dist/index.js +2 -2
- package/dist/mcp.js +5 -5
- package/dist/{parser-3EARWV2H.js → parser-5FSEFR3R.js} +38 -4
- package/dist/parser-5FSEFR3R.js.map +1 -0
- package/dist/{parser-STGI5I5K.js → parser-AWEGMHHV.js} +37 -3
- package/dist/parser-AWEGMHHV.js.map +1 -0
- package/dist/{parser-X34HD2KQ.cjs → parser-PCTX7LGN.cjs} +49 -15
- package/dist/parser-PCTX7LGN.cjs.map +1 -0
- package/dist/render-ATQNKOT2.js +9 -0
- package/dist/{watch-KVYJ46S6.js → watch-Y7BAYXJE.js} +5 -5
- package/package.json +1 -1
- package/dist/parser-3EARWV2H.js.map +0 -1
- package/dist/parser-STGI5I5K.js.map +0 -1
- package/dist/parser-X34HD2KQ.cjs.map +0 -1
- package/dist/render-FPWZ6YNZ.js +0 -9
- /package/dist/{-QMW2GDWP.js.map → -OPZIF3QT.js.map} +0 -0
- /package/dist/{chunk-SNSAZ7FA.js.map → chunk-7Z43WEML.js.map} +0 -0
- /package/dist/{chunk-O27B5IRL.js.map → chunk-BUDM6ULT.js.map} +0 -0
- /package/dist/{chunk-GETZFABK.js.map → chunk-ILR7GF3W.js.map} +0 -0
- /package/dist/{chunk-D4JKKSSI.js.map → chunk-NGKIAZ6G.js.map} +0 -0
- /package/dist/{chunk-TUBD3EEF.js.map → chunk-RUYSNNYZ.js.map} +0 -0
- /package/dist/{render-FPWZ6YNZ.js.map → render-ATQNKOT2.js.map} +0 -0
- /package/dist/{watch-KVYJ46S6.js.map → watch-Y7BAYXJE.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
blocksToMarkdown,
|
|
7
7
|
safeMax,
|
|
8
8
|
safeMin
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NGKIAZ6G.js";
|
|
10
10
|
import {
|
|
11
11
|
parsePageRange
|
|
12
12
|
} from "./chunk-GE43BE46.js";
|
|
@@ -237,10 +237,40 @@ var EDGE_MIN_SPAN = 12;
|
|
|
237
237
|
var EDGE_INSET = 15;
|
|
238
238
|
var EDGE_NEAR = 10;
|
|
239
239
|
var EDGE_CONNECT_TOL = 5;
|
|
240
|
+
var CHAIN_Y_TOL = 1.5;
|
|
241
|
+
var CHAIN_GAP = 3;
|
|
242
|
+
function chainCollinearRules(horizontals) {
|
|
243
|
+
if (horizontals.length <= 1) return horizontals;
|
|
244
|
+
const sorted = [...horizontals].sort((a, b) => a.y1 - b.y1 || a.x1 - b.x1);
|
|
245
|
+
const rules = [];
|
|
246
|
+
let bandStart = 0;
|
|
247
|
+
const flushBand = (end) => {
|
|
248
|
+
const band = sorted.slice(bandStart, end).sort((a, b) => a.x1 - b.x1);
|
|
249
|
+
let cur = { ...band[0] };
|
|
250
|
+
for (let i = 1; i < band.length; i++) {
|
|
251
|
+
const seg = band[i];
|
|
252
|
+
if (seg.x1 - cur.x2 <= CHAIN_GAP) {
|
|
253
|
+
if (seg.x2 > cur.x2) cur.x2 = seg.x2;
|
|
254
|
+
if (seg.lineWidth > cur.lineWidth) cur.lineWidth = seg.lineWidth;
|
|
255
|
+
} else {
|
|
256
|
+
rules.push(cur);
|
|
257
|
+
cur = { ...seg };
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
rules.push(cur);
|
|
261
|
+
};
|
|
262
|
+
for (let i = 1; i <= sorted.length; i++) {
|
|
263
|
+
if (i === sorted.length || sorted[i].y1 - sorted[bandStart].y1 > CHAIN_Y_TOL) {
|
|
264
|
+
flushBand(i);
|
|
265
|
+
bandStart = i;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return rules;
|
|
269
|
+
}
|
|
240
270
|
function closeOpenTableEdges(horizontals, verticals) {
|
|
241
271
|
if (horizontals.length < EDGE_MIN_RULES) return verticals;
|
|
242
272
|
const groups = [];
|
|
243
|
-
for (const hl of horizontals) {
|
|
273
|
+
for (const hl of chainCollinearRules(horizontals)) {
|
|
244
274
|
let placed = false;
|
|
245
275
|
for (const g2 of groups) {
|
|
246
276
|
if (Math.abs(g2[0].x1 - hl.x1) <= EDGE_ALIGN_TOL && Math.abs(g2[0].x2 - hl.x2) <= EDGE_ALIGN_TOL) {
|
|
@@ -2295,6 +2325,10 @@ function detectHeadings(blocks, medianFontSize) {
|
|
|
2295
2325
|
function shouldDemoteTable(table) {
|
|
2296
2326
|
const allCells = table.cells.flatMap((row) => row.map((c) => c.text.trim())).filter(Boolean);
|
|
2297
2327
|
const allText = allCells.join(" ");
|
|
2328
|
+
if (table.rows >= 2 && table.cols >= 2 && table.cells[0].every((c) => {
|
|
2329
|
+
const t = c.text.trim();
|
|
2330
|
+
return t.length > 0 && t.length <= 12 && !/[□■◆○●▶ㅇ<>]/.test(t);
|
|
2331
|
+
}) && table.cells.slice(1).some((row) => row.some((c) => c.text.trim() !== ""))) return false;
|
|
2298
2332
|
if (table.rows <= 3 && table.cols <= 3) {
|
|
2299
2333
|
const totalCells2 = table.rows * table.cols;
|
|
2300
2334
|
const emptyCells2 = totalCells2 - allCells.length;
|
|
@@ -3437,4 +3471,4 @@ export {
|
|
|
3437
3471
|
parsePdfDocument,
|
|
3438
3472
|
removeHeaderFooterBlocks
|
|
3439
3473
|
};
|
|
3440
|
-
//# sourceMappingURL=parser-
|
|
3474
|
+
//# sourceMappingURL=parser-AWEGMHHV.js.map
|