@superdoc-dev/cli 0.2.0-next.44 → 0.2.0-next.46

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -6
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -69979,17 +69979,32 @@ var init_list_numbering_helpers = __esm(() => {
69979
69979
 
69980
69980
  // ../../packages/super-editor/src/core/helpers/markdown/mdastToProseMirror.ts
69981
69981
  function convertMdastToBlocks(root2, ctx) {
69982
- return flatMapChildren(root2, ctx);
69982
+ return flatMapRootChildrenPreserveBlankLines(root2, ctx);
69983
69983
  }
69984
- function flatMapChildren(parent, ctx) {
69985
- if (!parent.children)
69986
- return [];
69984
+ function flatMapRootChildrenPreserveBlankLines(root2, ctx) {
69985
+ const children = root2.children ?? [];
69987
69986
  const blocks = [];
69988
- for (const child of parent.children) {
69987
+ for (let i = 0;i < children.length; i += 1) {
69988
+ const child = children[i];
69989
69989
  blocks.push(...convertBlockNode(child, ctx));
69990
+ const next = children[i + 1];
69991
+ if (!next)
69992
+ continue;
69993
+ const blankLines = countBlankLinesBetweenSiblings(child, next);
69994
+ for (let j = 0;j < blankLines; j += 1) {
69995
+ blocks.push(makeParagraph([]));
69996
+ }
69990
69997
  }
69991
69998
  return blocks;
69992
69999
  }
70000
+ function countBlankLinesBetweenSiblings(previous3, next) {
70001
+ const previousEndLine = previous3.position?.end?.line;
70002
+ const nextStartLine = next.position?.start?.line;
70003
+ if (typeof previousEndLine !== "number" || typeof nextStartLine !== "number") {
70004
+ return 0;
70005
+ }
70006
+ return Math.max(0, nextStartLine - previousEndLine - 2);
70007
+ }
69993
70008
  function convertBlockNode(node3, ctx) {
69994
70009
  switch (node3.type) {
69995
70010
  case "paragraph":
@@ -70135,6 +70150,14 @@ function convertTable(node3, ctx) {
70135
70150
  }
70136
70151
  return {
70137
70152
  type: "table",
70153
+ attrs: {
70154
+ tableProperties: {
70155
+ tableWidth: {
70156
+ value: FULL_WIDTH_TABLE_PCT,
70157
+ type: "pct"
70158
+ }
70159
+ }
70160
+ },
70138
70161
  content: rows
70139
70162
  };
70140
70163
  }
@@ -70286,7 +70309,7 @@ function addDiagnostic2(ctx, severity, nodeType, message, node3) {
70286
70309
  }
70287
70310
  ctx.diagnostics.push(diagnostic);
70288
70311
  }
70289
- var HEADING_STYLE_MAP;
70312
+ var FULL_WIDTH_TABLE_PCT = 5000, HEADING_STYLE_MAP;
70290
70313
  var init_mdastToProseMirror = __esm(() => {
70291
70314
  init_list_numbering_helpers();
70292
70315
  HEADING_STYLE_MAP = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.44",
3
+ "version": "0.2.0-next.46",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -19,21 +19,21 @@
19
19
  "@types/bun": "^1.3.8",
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
- "@superdoc/document-api": "0.0.1",
23
- "@superdoc/super-editor": "0.0.1",
24
22
  "@superdoc/pm-adapter": "0.0.0",
25
- "superdoc": "1.16.0"
23
+ "@superdoc/super-editor": "0.0.1",
24
+ "superdoc": "1.16.0",
25
+ "@superdoc/document-api": "0.0.1"
26
26
  },
27
27
  "module": "src/index.ts",
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.44",
33
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.44",
34
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.44",
35
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.44",
36
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.44"
32
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.46",
33
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.46",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.46",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.46",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.46"
37
37
  },
38
38
  "scripts": {
39
39
  "dev": "bun run src/index.ts",