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

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 +20 -5
  2. package/package.json +8 -8
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 - 1);
70007
+ }
69993
70008
  function convertBlockNode(node3, ctx) {
69994
70009
  switch (node3.type) {
69995
70010
  case "paragraph":
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.45",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,19 +21,19 @@
21
21
  "typescript": "^5.9.2",
22
22
  "@superdoc/document-api": "0.0.1",
23
23
  "@superdoc/super-editor": "0.0.1",
24
- "@superdoc/pm-adapter": "0.0.0",
25
- "superdoc": "1.16.0"
24
+ "superdoc": "1.16.0",
25
+ "@superdoc/pm-adapter": "0.0.0"
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.45",
33
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.45",
34
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.45",
35
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.45",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.45"
37
37
  },
38
38
  "scripts": {
39
39
  "dev": "bun run src/index.ts",