@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.js
CHANGED
|
@@ -6951,7 +6951,11 @@ var Node = class {
|
|
|
6951
6951
|
resolve(config = {}) {
|
|
6952
6952
|
return Object.assign(new Node(), this, {
|
|
6953
6953
|
children: this.children.map((child) => child.resolve(config)),
|
|
6954
|
-
attributes: resolve(this.attributes, config)
|
|
6954
|
+
attributes: resolve(this.attributes, config),
|
|
6955
|
+
slots: Object.fromEntries(Object.entries(this.slots).map(([name, slot2]) => [
|
|
6956
|
+
name,
|
|
6957
|
+
slot2.resolve(config)
|
|
6958
|
+
]))
|
|
6955
6959
|
});
|
|
6956
6960
|
}
|
|
6957
6961
|
findSchema(config = {}) {
|
|
@@ -7296,15 +7300,20 @@ function* formatNode(n, o = {}) {
|
|
|
7296
7300
|
}
|
|
7297
7301
|
yield NL;
|
|
7298
7302
|
} else {
|
|
7299
|
-
|
|
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
|
+
}
|
|
7300
7309
|
const [head, ...rows] = table3;
|
|
7301
|
-
const ml = table3.map((arr) => arr.map((s2) => s2.length).reduce(max)).reduce(max);
|
|
7302
|
-
yield* formatTableRow(head.map((h) => h + SPACE.repeat(ml - h.length)));
|
|
7303
7310
|
yield NL;
|
|
7304
|
-
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])));
|
|
7305
7314
|
yield NL;
|
|
7306
7315
|
for (const row of rows) {
|
|
7307
|
-
yield* formatTableRow(row.map((
|
|
7316
|
+
yield* formatTableRow(row.map((cell, i) => cell + SPACE.repeat(widths[i] - cell.length)));
|
|
7308
7317
|
yield NL;
|
|
7309
7318
|
}
|
|
7310
7319
|
}
|