@markdoc/markdoc 0.3.3 → 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 +15 -6
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +2 -2
- package/dist/src/ast/node.d.ts.map +1 -1
- package/dist/src/formatter.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ast/node.ts +6 -0
- package/src/formatter.test.ts +4 -4
- package/src/formatter.ts +16 -8
package/dist/index.mjs
CHANGED
|
@@ -6927,7 +6927,11 @@ var Node = class {
|
|
|
6927
6927
|
resolve(config = {}) {
|
|
6928
6928
|
return Object.assign(new Node(), this, {
|
|
6929
6929
|
children: this.children.map((child) => child.resolve(config)),
|
|
6930
|
-
attributes: resolve(this.attributes, config)
|
|
6930
|
+
attributes: resolve(this.attributes, config),
|
|
6931
|
+
slots: Object.fromEntries(Object.entries(this.slots).map(([name, slot2]) => [
|
|
6932
|
+
name,
|
|
6933
|
+
slot2.resolve(config)
|
|
6934
|
+
]))
|
|
6931
6935
|
});
|
|
6932
6936
|
}
|
|
6933
6937
|
findSchema(config = {}) {
|
|
@@ -7272,15 +7276,20 @@ function* formatNode(n, o = {}) {
|
|
|
7272
7276
|
}
|
|
7273
7277
|
yield NL;
|
|
7274
7278
|
} else {
|
|
7275
|
-
|
|
7279
|
+
const widths = [];
|
|
7280
|
+
for (const row of table3) {
|
|
7281
|
+
for (let i = 0; i < row.length; i++) {
|
|
7282
|
+
widths[i] = widths[i] ? Math.max(widths[i], row[i].length) : row[i].length;
|
|
7283
|
+
}
|
|
7284
|
+
}
|
|
7276
7285
|
const [head, ...rows] = table3;
|
|
7277
|
-
const ml = table3.map((arr) => arr.map((s2) => s2.length).reduce(max)).reduce(max);
|
|
7278
|
-
yield* formatTableRow(head.map((h) => h + SPACE.repeat(ml - h.length)));
|
|
7279
7286
|
yield NL;
|
|
7280
|
-
yield* formatTableRow(head.map(() =>
|
|
7287
|
+
yield* formatTableRow(head.map((cell, i) => cell + SPACE.repeat(widths[i] - cell.length)));
|
|
7288
|
+
yield NL;
|
|
7289
|
+
yield* formatTableRow(head.map((cell, i) => "-".repeat(widths[i])));
|
|
7281
7290
|
yield NL;
|
|
7282
7291
|
for (const row of rows) {
|
|
7283
|
-
yield* formatTableRow(row.map((
|
|
7292
|
+
yield* formatTableRow(row.map((cell, i) => cell + SPACE.repeat(widths[i] - cell.length)));
|
|
7284
7293
|
yield NL;
|
|
7285
7294
|
}
|
|
7286
7295
|
}
|