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.
Files changed (34) hide show
  1. package/README.md +6 -0
  2. package/dist/{-QMW2GDWP.js → -OPZIF3QT.js} +5 -5
  3. package/dist/{chunk-RCSDSN5Y.cjs → chunk-2C5GCXPJ.cjs} +2 -2
  4. package/dist/{chunk-RCSDSN5Y.cjs.map → chunk-2C5GCXPJ.cjs.map} +1 -1
  5. package/dist/{chunk-SNSAZ7FA.js → chunk-7Z43WEML.js} +2 -2
  6. package/dist/{chunk-O27B5IRL.js → chunk-BUDM6ULT.js} +2 -2
  7. package/dist/{chunk-GETZFABK.js → chunk-ILR7GF3W.js} +2 -2
  8. package/dist/{chunk-D4JKKSSI.js → chunk-NGKIAZ6G.js} +2 -2
  9. package/dist/{chunk-TUBD3EEF.js → chunk-RUYSNNYZ.js} +5 -5
  10. package/dist/cli.js +7 -7
  11. package/dist/index.cjs +118 -118
  12. package/dist/index.js +2 -2
  13. package/dist/mcp.js +5 -5
  14. package/dist/{parser-3EARWV2H.js → parser-5FSEFR3R.js} +38 -4
  15. package/dist/parser-5FSEFR3R.js.map +1 -0
  16. package/dist/{parser-STGI5I5K.js → parser-AWEGMHHV.js} +37 -3
  17. package/dist/parser-AWEGMHHV.js.map +1 -0
  18. package/dist/{parser-X34HD2KQ.cjs → parser-PCTX7LGN.cjs} +49 -15
  19. package/dist/parser-PCTX7LGN.cjs.map +1 -0
  20. package/dist/render-ATQNKOT2.js +9 -0
  21. package/dist/{watch-KVYJ46S6.js → watch-Y7BAYXJE.js} +5 -5
  22. package/package.json +1 -1
  23. package/dist/parser-3EARWV2H.js.map +0 -1
  24. package/dist/parser-STGI5I5K.js.map +0 -1
  25. package/dist/parser-X34HD2KQ.cjs.map +0 -1
  26. package/dist/render-FPWZ6YNZ.js +0 -9
  27. /package/dist/{-QMW2GDWP.js.map → -OPZIF3QT.js.map} +0 -0
  28. /package/dist/{chunk-SNSAZ7FA.js.map → chunk-7Z43WEML.js.map} +0 -0
  29. /package/dist/{chunk-O27B5IRL.js.map → chunk-BUDM6ULT.js.map} +0 -0
  30. /package/dist/{chunk-GETZFABK.js.map → chunk-ILR7GF3W.js.map} +0 -0
  31. /package/dist/{chunk-D4JKKSSI.js.map → chunk-NGKIAZ6G.js.map} +0 -0
  32. /package/dist/{chunk-TUBD3EEF.js.map → chunk-RUYSNNYZ.js.map} +0 -0
  33. /package/dist/{render-FPWZ6YNZ.js.map → render-ATQNKOT2.js.map} +0 -0
  34. /package/dist/{watch-KVYJ46S6.js.map → watch-Y7BAYXJE.js.map} +0 -0
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  sanitizeHref,
20
20
  stripDtd,
21
21
  toArrayBuffer
22
- } from "./chunk-D4JKKSSI.js";
22
+ } from "./chunk-NGKIAZ6G.js";
23
23
  import {
24
24
  parsePageRange
25
25
  } from "./chunk-GE43BE46.js";
@@ -25548,7 +25548,7 @@ async function parseHwp(buffer, options) {
25548
25548
  async function parsePdf(buffer, options) {
25549
25549
  let parsePdfDocument;
25550
25550
  try {
25551
- const mod = await import("./parser-STGI5I5K.js");
25551
+ const mod = await import("./parser-AWEGMHHV.js");
25552
25552
  parsePdfDocument = mod.parsePdfDocument;
25553
25553
  } catch {
25554
25554
  return {
package/dist/mcp.js CHANGED
@@ -10,22 +10,22 @@ import {
10
10
  parse,
11
11
  patchHwp,
12
12
  patchHwpx
13
- } from "./chunk-TUBD3EEF.js";
13
+ } from "./chunk-RUYSNNYZ.js";
14
14
  import {
15
15
  detectFormat,
16
16
  detectZipFormat
17
17
  } from "./chunk-MEPHGCPQ.js";
18
- import "./chunk-GETZFABK.js";
18
+ import "./chunk-ILR7GF3W.js";
19
19
  import {
20
20
  blocksToMarkdown
21
- } from "./chunk-O27B5IRL.js";
21
+ } from "./chunk-BUDM6ULT.js";
22
22
  import "./chunk-MOL7MDBG.js";
23
23
  import {
24
24
  KordocError,
25
25
  VERSION,
26
26
  sanitizeError,
27
27
  toArrayBuffer
28
- } from "./chunk-SNSAZ7FA.js";
28
+ } from "./chunk-7Z43WEML.js";
29
29
 
30
30
  // src/mcp.ts
31
31
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -196,7 +196,7 @@ server.tool(
196
196
  break;
197
197
  case "pdf":
198
198
  try {
199
- const { extractPdfMetadataOnly } = await import("./parser-3EARWV2H.js");
199
+ const { extractPdfMetadataOnly } = await import("./parser-5FSEFR3R.js");
200
200
  metadata = await extractPdfMetadataOnly(buffer);
201
201
  } catch {
202
202
  metadata = void 0;
@@ -4,7 +4,7 @@ import {
4
4
  HEADING_RATIO_H2,
5
5
  HEADING_RATIO_H3,
6
6
  blocksToMarkdown
7
- } from "./chunk-O27B5IRL.js";
7
+ } from "./chunk-BUDM6ULT.js";
8
8
  import {
9
9
  parsePageRange
10
10
  } from "./chunk-MOL7MDBG.js";
@@ -12,7 +12,7 @@ import {
12
12
  KordocError,
13
13
  safeMax,
14
14
  safeMin
15
- } from "./chunk-SNSAZ7FA.js";
15
+ } from "./chunk-7Z43WEML.js";
16
16
 
17
17
  // src/pdf/line-extract.ts
18
18
  import { OPS } from "pdfjs-dist/legacy/build/pdf.mjs";
@@ -240,10 +240,40 @@ var EDGE_MIN_SPAN = 12;
240
240
  var EDGE_INSET = 15;
241
241
  var EDGE_NEAR = 10;
242
242
  var EDGE_CONNECT_TOL = 5;
243
+ var CHAIN_Y_TOL = 1.5;
244
+ var CHAIN_GAP = 3;
245
+ function chainCollinearRules(horizontals) {
246
+ if (horizontals.length <= 1) return horizontals;
247
+ const sorted = [...horizontals].sort((a, b) => a.y1 - b.y1 || a.x1 - b.x1);
248
+ const rules = [];
249
+ let bandStart = 0;
250
+ const flushBand = (end) => {
251
+ const band = sorted.slice(bandStart, end).sort((a, b) => a.x1 - b.x1);
252
+ let cur = { ...band[0] };
253
+ for (let i = 1; i < band.length; i++) {
254
+ const seg = band[i];
255
+ if (seg.x1 - cur.x2 <= CHAIN_GAP) {
256
+ if (seg.x2 > cur.x2) cur.x2 = seg.x2;
257
+ if (seg.lineWidth > cur.lineWidth) cur.lineWidth = seg.lineWidth;
258
+ } else {
259
+ rules.push(cur);
260
+ cur = { ...seg };
261
+ }
262
+ }
263
+ rules.push(cur);
264
+ };
265
+ for (let i = 1; i <= sorted.length; i++) {
266
+ if (i === sorted.length || sorted[i].y1 - sorted[bandStart].y1 > CHAIN_Y_TOL) {
267
+ flushBand(i);
268
+ bandStart = i;
269
+ }
270
+ }
271
+ return rules;
272
+ }
243
273
  function closeOpenTableEdges(horizontals, verticals) {
244
274
  if (horizontals.length < EDGE_MIN_RULES) return verticals;
245
275
  const groups = [];
246
- for (const hl of horizontals) {
276
+ for (const hl of chainCollinearRules(horizontals)) {
247
277
  let placed = false;
248
278
  for (const g2 of groups) {
249
279
  if (Math.abs(g2[0].x1 - hl.x1) <= EDGE_ALIGN_TOL && Math.abs(g2[0].x2 - hl.x2) <= EDGE_ALIGN_TOL) {
@@ -2298,6 +2328,10 @@ function detectHeadings(blocks, medianFontSize) {
2298
2328
  function shouldDemoteTable(table) {
2299
2329
  const allCells = table.cells.flatMap((row) => row.map((c) => c.text.trim())).filter(Boolean);
2300
2330
  const allText = allCells.join(" ");
2331
+ if (table.rows >= 2 && table.cols >= 2 && table.cells[0].every((c) => {
2332
+ const t = c.text.trim();
2333
+ return t.length > 0 && t.length <= 12 && !/[□■◆○●▶ㅇ<>]/.test(t);
2334
+ }) && table.cells.slice(1).some((row) => row.some((c) => c.text.trim() !== ""))) return false;
2301
2335
  if (table.rows <= 3 && table.cols <= 3) {
2302
2336
  const totalCells2 = table.rows * table.cols;
2303
2337
  const emptyCells2 = totalCells2 - allCells.length;
@@ -3440,4 +3474,4 @@ export {
3440
3474
  parsePdfDocument,
3441
3475
  removeHeaderFooterBlocks
3442
3476
  };
3443
- //# sourceMappingURL=parser-3EARWV2H.js.map
3477
+ //# sourceMappingURL=parser-5FSEFR3R.js.map