markdown-codec 6.3.5 → 6.3.7

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/codec.d.cts CHANGED
@@ -1427,9 +1427,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1427
1427
  type: z.ZodEnum<{
1428
1428
  date: "date";
1429
1429
  custom: "custom";
1430
+ time: "time";
1430
1431
  decimal: "decimal";
1431
1432
  list: "list";
1432
- time: "time";
1433
1433
  whole: "whole";
1434
1434
  textLength: "textLength";
1435
1435
  }>;
@@ -1885,10 +1885,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1885
1885
  value: z.ZodObject<{
1886
1886
  type: z.ZodEnum<{
1887
1887
  formula: "formula";
1888
- percent: "percent";
1889
1888
  num: "num";
1890
- max: "max";
1891
1889
  min: "min";
1890
+ max: "max";
1891
+ percent: "percent";
1892
1892
  percentile: "percentile";
1893
1893
  }>;
1894
1894
  value: z.ZodOptional<z.ZodString>;
@@ -1931,10 +1931,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1931
1931
  min: z.ZodObject<{
1932
1932
  type: z.ZodEnum<{
1933
1933
  formula: "formula";
1934
- percent: "percent";
1935
1934
  num: "num";
1936
- max: "max";
1937
1935
  min: "min";
1936
+ max: "max";
1937
+ percent: "percent";
1938
1938
  percentile: "percentile";
1939
1939
  }>;
1940
1940
  value: z.ZodOptional<z.ZodString>;
@@ -1942,10 +1942,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1942
1942
  max: z.ZodObject<{
1943
1943
  type: z.ZodEnum<{
1944
1944
  formula: "formula";
1945
- percent: "percent";
1946
1945
  num: "num";
1947
- max: "max";
1948
1946
  min: "min";
1947
+ max: "max";
1948
+ percent: "percent";
1949
1949
  percentile: "percentile";
1950
1950
  }>;
1951
1951
  value: z.ZodOptional<z.ZodString>;
@@ -1989,10 +1989,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1989
1989
  thresholds: z.ZodArray<z.ZodObject<{
1990
1990
  type: z.ZodEnum<{
1991
1991
  formula: "formula";
1992
- percent: "percent";
1993
1992
  num: "num";
1994
- max: "max";
1995
1993
  min: "min";
1994
+ max: "max";
1995
+ percent: "percent";
1996
1996
  percentile: "percentile";
1997
1997
  }>;
1998
1998
  value: z.ZodOptional<z.ZodString>;
package/dist/codec.d.ts CHANGED
@@ -1427,9 +1427,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1427
1427
  type: z.ZodEnum<{
1428
1428
  date: "date";
1429
1429
  custom: "custom";
1430
+ time: "time";
1430
1431
  decimal: "decimal";
1431
1432
  list: "list";
1432
- time: "time";
1433
1433
  whole: "whole";
1434
1434
  textLength: "textLength";
1435
1435
  }>;
@@ -1885,10 +1885,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1885
1885
  value: z.ZodObject<{
1886
1886
  type: z.ZodEnum<{
1887
1887
  formula: "formula";
1888
- percent: "percent";
1889
1888
  num: "num";
1890
- max: "max";
1891
1889
  min: "min";
1890
+ max: "max";
1891
+ percent: "percent";
1892
1892
  percentile: "percentile";
1893
1893
  }>;
1894
1894
  value: z.ZodOptional<z.ZodString>;
@@ -1931,10 +1931,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1931
1931
  min: z.ZodObject<{
1932
1932
  type: z.ZodEnum<{
1933
1933
  formula: "formula";
1934
- percent: "percent";
1935
1934
  num: "num";
1936
- max: "max";
1937
1935
  min: "min";
1936
+ max: "max";
1937
+ percent: "percent";
1938
1938
  percentile: "percentile";
1939
1939
  }>;
1940
1940
  value: z.ZodOptional<z.ZodString>;
@@ -1942,10 +1942,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1942
1942
  max: z.ZodObject<{
1943
1943
  type: z.ZodEnum<{
1944
1944
  formula: "formula";
1945
- percent: "percent";
1946
1945
  num: "num";
1947
- max: "max";
1948
1946
  min: "min";
1947
+ max: "max";
1948
+ percent: "percent";
1949
1949
  percentile: "percentile";
1950
1950
  }>;
1951
1951
  value: z.ZodOptional<z.ZodString>;
@@ -1989,10 +1989,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1989
1989
  thresholds: z.ZodArray<z.ZodObject<{
1990
1990
  type: z.ZodEnum<{
1991
1991
  formula: "formula";
1992
- percent: "percent";
1993
1992
  num: "num";
1994
- max: "max";
1995
1993
  min: "min";
1994
+ max: "max";
1995
+ percent: "percent";
1996
1996
  percentile: "percentile";
1997
1997
  }>;
1998
1998
  value: z.ZodOptional<z.ZodString>;
@@ -254,6 +254,7 @@ function lowerListItem(item, numId, level, context, contentWidthPt) {
254
254
  };
255
255
  const blocks = [];
256
256
  let ownLevelBlockCount = 0;
257
+ let firstOwnBlock;
257
258
  for (const child of item.children) {
258
259
  if (child.type === "list") {
259
260
  blocks.push(...lowerList(child, numId, level + 1, context, contentWidthPt));
@@ -261,9 +262,10 @@ function lowerListItem(item, numId, level, context, contentWidthPt) {
261
262
  }
262
263
  const childBlocks = lowerBlock(child, itemContext, contentWidthPt);
263
264
  ownLevelBlockCount += childBlocks.length;
265
+ firstOwnBlock ??= childBlocks[0];
264
266
  blocks.push(...childBlocks);
265
267
  }
266
- if (ownLevelBlockCount === 0) blocks.unshift(decorateParagraph({
268
+ if (ownLevelBlockCount === 0 || firstOwnBlock?.kind === "constructStart") blocks.unshift(decorateParagraph({
267
269
  kind: "paragraph",
268
270
  runs: []
269
271
  }, itemContext));
@@ -253,6 +253,7 @@ function lowerListItem(item, numId, level, context, contentWidthPt) {
253
253
  };
254
254
  const blocks = [];
255
255
  let ownLevelBlockCount = 0;
256
+ let firstOwnBlock;
256
257
  for (const child of item.children) {
257
258
  if (child.type === "list") {
258
259
  blocks.push(...lowerList(child, numId, level + 1, context, contentWidthPt));
@@ -260,9 +261,10 @@ function lowerListItem(item, numId, level, context, contentWidthPt) {
260
261
  }
261
262
  const childBlocks = lowerBlock(child, itemContext, contentWidthPt);
262
263
  ownLevelBlockCount += childBlocks.length;
264
+ firstOwnBlock ??= childBlocks[0];
263
265
  blocks.push(...childBlocks);
264
266
  }
265
- if (ownLevelBlockCount === 0) blocks.unshift(decorateParagraph({
267
+ if (ownLevelBlockCount === 0 || firstOwnBlock?.kind === "constructStart") blocks.unshift(decorateParagraph({
266
268
  kind: "paragraph",
267
269
  runs: []
268
270
  }, itemContext));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-codec",
3
- "version": "6.3.5",
3
+ "version": "6.3.7",
4
4
  "description": "Hand-written CommonMark+GFM <-> DocumentTree codec, built on document-schema.js",
5
5
  "type": "module",
6
6
  "repository": {
@@ -83,7 +83,7 @@
83
83
  "license": "MIT",
84
84
  "packageManager": "pnpm@11.6.0",
85
85
  "dependencies": {
86
- "document-schema.js": "^7.0.0",
86
+ "document-schema.js": "^7.1.0",
87
87
  "zod": "^4.4.3"
88
88
  },
89
89
  "devDependencies": {