@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 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
- yield NL;
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(() => "-".repeat(ml)));
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((r) => r + SPACE.repeat(ml - r.length)));
7316
+ yield* formatTableRow(row.map((cell, i) => cell + SPACE.repeat(widths[i] - cell.length)));
7308
7317
  yield NL;
7309
7318
  }
7310
7319
  }