@markdoc/markdoc 0.3.4 → 0.3.5
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/index.js +10 -5
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +10 -5
- package/dist/index.mjs.map +2 -2
- package/dist/src/formatter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/formatter.test.ts +4 -4
- package/src/formatter.ts +16 -8
package/dist/index.js
CHANGED
|
@@ -7300,15 +7300,20 @@ function* formatNode(n, o = {}) {
|
|
|
7300
7300
|
}
|
|
7301
7301
|
yield NL;
|
|
7302
7302
|
} else {
|
|
7303
|
-
|
|
7303
|
+
const widths = [];
|
|
7304
|
+
for (const row of table3) {
|
|
7305
|
+
for (let i = 0; i < row.length; i++) {
|
|
7306
|
+
widths[i] = widths[i] ? Math.max(widths[i], row[i].length) : row[i].length;
|
|
7307
|
+
}
|
|
7308
|
+
}
|
|
7304
7309
|
const [head, ...rows] = table3;
|
|
7305
|
-
const ml = table3.map((arr) => arr.map((s2) => s2.length).reduce(max)).reduce(max);
|
|
7306
|
-
yield* formatTableRow(head.map((h) => h + SPACE.repeat(ml - h.length)));
|
|
7307
7310
|
yield NL;
|
|
7308
|
-
yield* formatTableRow(head.map(() =>
|
|
7311
|
+
yield* formatTableRow(head.map((cell, i) => cell + SPACE.repeat(widths[i] - cell.length)));
|
|
7312
|
+
yield NL;
|
|
7313
|
+
yield* formatTableRow(head.map((cell, i) => "-".repeat(widths[i])));
|
|
7309
7314
|
yield NL;
|
|
7310
7315
|
for (const row of rows) {
|
|
7311
|
-
yield* formatTableRow(row.map((
|
|
7316
|
+
yield* formatTableRow(row.map((cell, i) => cell + SPACE.repeat(widths[i] - cell.length)));
|
|
7312
7317
|
yield NL;
|
|
7313
7318
|
}
|
|
7314
7319
|
}
|