kordoc 2.2.2 → 2.2.3
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/dist/{chunk-R34CFFNV.js → chunk-AIG7SDWU.js} +40 -2
- package/dist/chunk-AIG7SDWU.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/index.cjs +39 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{watch-VNJDVUVQ.js → watch-H672QAW2.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-R34CFFNV.js.map +0 -1
- /package/dist/{watch-VNJDVUVQ.js.map → watch-H672QAW2.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-MOL7MDBG.js";
|
|
9
9
|
|
|
10
10
|
// src/utils.ts
|
|
11
|
-
var VERSION = true ? "2.2.
|
|
11
|
+
var VERSION = true ? "2.2.3" : "0.0.0-dev";
|
|
12
12
|
function toArrayBuffer(buf) {
|
|
13
13
|
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
|
14
14
|
return buf.buffer;
|
|
@@ -330,9 +330,47 @@ function blocksToMarkdown(blocks) {
|
|
|
330
330
|
}
|
|
331
331
|
return lines.join("\n").trim();
|
|
332
332
|
}
|
|
333
|
+
function hasMergedCells(table) {
|
|
334
|
+
for (const row of table.cells) {
|
|
335
|
+
for (const cell of row) {
|
|
336
|
+
if (cell.colSpan > 1 || cell.rowSpan > 1) return true;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
function tableToHtml(table) {
|
|
342
|
+
const { cells, rows: numRows, cols: numCols } = table;
|
|
343
|
+
const skip = /* @__PURE__ */ new Set();
|
|
344
|
+
const lines = ["<table>"];
|
|
345
|
+
for (let r = 0; r < numRows; r++) {
|
|
346
|
+
const tag = r === 0 ? "th" : "td";
|
|
347
|
+
const rowHtml = [];
|
|
348
|
+
for (let c = 0; c < numCols; c++) {
|
|
349
|
+
if (skip.has(`${r},${c}`)) continue;
|
|
350
|
+
const cell = cells[r]?.[c];
|
|
351
|
+
if (!cell) continue;
|
|
352
|
+
for (let dr = 0; dr < cell.rowSpan; dr++) {
|
|
353
|
+
for (let dc = 0; dc < cell.colSpan; dc++) {
|
|
354
|
+
if (dr === 0 && dc === 0) continue;
|
|
355
|
+
if (r + dr < numRows && c + dc < numCols) skip.add(`${r + dr},${c + dc}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const text = sanitizeText(cell.text).replace(/\n/g, "<br>");
|
|
359
|
+
const attrs = [];
|
|
360
|
+
if (cell.colSpan > 1) attrs.push(`colspan="${cell.colSpan}"`);
|
|
361
|
+
if (cell.rowSpan > 1) attrs.push(`rowspan="${cell.rowSpan}"`);
|
|
362
|
+
const attrStr = attrs.length ? " " + attrs.join(" ") : "";
|
|
363
|
+
rowHtml.push(`<${tag}${attrStr}>${text}</${tag}>`);
|
|
364
|
+
}
|
|
365
|
+
if (rowHtml.length) lines.push(`<tr>${rowHtml.join("")}</tr>`);
|
|
366
|
+
}
|
|
367
|
+
lines.push("</table>");
|
|
368
|
+
return lines.join("\n");
|
|
369
|
+
}
|
|
333
370
|
function tableToMarkdown(table) {
|
|
334
371
|
if (table.rows === 0 || table.cols === 0) return "";
|
|
335
372
|
const { cells, rows: numRows, cols: numCols } = table;
|
|
373
|
+
if (hasMergedCells(table)) return tableToHtml(table);
|
|
336
374
|
if (numRows === 1 && numCols === 1) {
|
|
337
375
|
const content = sanitizeText(cells[0][0].text);
|
|
338
376
|
if (!content) return "";
|
|
@@ -6260,4 +6298,4 @@ export {
|
|
|
6260
6298
|
extractFormFields,
|
|
6261
6299
|
parse
|
|
6262
6300
|
};
|
|
6263
|
-
//# sourceMappingURL=chunk-
|
|
6301
|
+
//# sourceMappingURL=chunk-AIG7SDWU.js.map
|