markdown-codec 6.3.7 → 6.4.0

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/README.md CHANGED
@@ -204,7 +204,9 @@ Every construct `src/lower`/`src/emit` cannot represent losslessly is a document
204
204
  - **`md/paragraph-indent-dropped`** — `indentLeftPt` without a recognised styleId; indent dropped, paragraph renders.
205
205
  - **`md/list-numid-fallback`** — a foreign or absent `numId` (depth-only `ContentListMembership`) falls back to a plain bullet list.
206
206
  - **`md/raw-html-preserved-as-text`** — see the raw-HTML entry above.
207
- - **`md/table-cell-formatting-dropped`** / **`md/table-cell-multi-paragraph-joined`** — GFM cells have no rich-formatting or multi-paragraph representation.
207
+ - **`md/table-cell-formatting-dropped`** — colSpan/rowSpan/background, or a non-paragraph, non-image block (a nested table, say), have no GFM cell representation at all; the cell still renders, unmerged/unstyled, with that content dropped.
208
+ - **`md/table-cell-multi-paragraph-joined`** — a cell carrying more than one block joins their rendered text with a literal `<br>`, real inline HTML every GFM table renderer treats as a genuine line break.
209
+ - **`md/table-cell-image-degraded`** — an `image`-kind cell block emits inline (`![alt](data:...)`) rather than being dropped; on read-back it degrades to a run carrying the alt text with the image's own data URI as that run's hyperlink, the same "nested image" shape an image inside emphasis/a link already degrades to elsewhere in this package.
208
210
  - **`md/duplicate-footnote-definition`** — two definitions share a label; every reference resolves to the first, both are kept as written.
209
211
  - **`md/footnote-body-heading-flattened`** — a heading inside a definition body is carried as literal ATX text, since a construct extent may not open or close a heading scope.
210
212
  - **`md/construct-unrepresented`** — a construct kind markdown has no syntax for renders transparently: its extent still appears, the construct itself does not.
@@ -1,6 +1,6 @@
1
1
  import { s as MarkdownDocumentNode } from "../ast-CNfTgS0N.cjs";
2
2
  import { r as FootnoteLabelSet } from "../footnote-CKk4JbLk.cjs";
3
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.cjs";
3
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.cjs";
4
4
  import { LinkReferenceMap } from "../inline/link.cjs";
5
5
  import { t as InlineParseOptions } from "../inline-CnO86zMw.cjs";
6
6
  //#region src/block/block.d.ts
@@ -1,6 +1,6 @@
1
1
  import { s as MarkdownDocumentNode } from "../ast-CNfTgS0N.js";
2
2
  import { r as FootnoteLabelSet } from "../footnote-CKk4JbLk.js";
3
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.js";
3
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.js";
4
4
  import { LinkReferenceMap } from "../inline/link.js";
5
5
  import { t as InlineParseOptions } from "../inline-DItZ-VVw.js";
6
6
  //#region src/block/block.d.ts
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.cjs";
2
2
  import { LinkReferenceDefinition } from "../inline/link.cjs";
3
3
  //#region src/block/definitions.d.ts
4
4
  declare function extractDefinitions(content: string, references: Map<string, LinkReferenceDefinition>, sink?: MarkdownDiagnosticSink, startLine?: number): string;
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.js";
2
2
  import { LinkReferenceDefinition } from "../inline/link.js";
3
3
  //#region src/block/definitions.d.ts
4
4
  declare function extractDefinitions(content: string, references: Map<string, LinkReferenceDefinition>, sink?: MarkdownDiagnosticSink, startLine?: number): string;
package/dist/codec.d.cts CHANGED
@@ -11,8 +11,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
11
11
  paragraph: z.ZodOptional<z.ZodObject<{
12
12
  alignment: z.ZodOptional<z.ZodEnum<{
13
13
  left: "left";
14
- center: "center";
15
14
  right: "right";
15
+ center: "center";
16
16
  justify: "justify";
17
17
  }>>;
18
18
  list: z.ZodOptional<z.ZodObject<{
@@ -159,8 +159,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
159
159
  paragraph: z.ZodOptional<z.ZodObject<{
160
160
  alignment: z.ZodOptional<z.ZodEnum<{
161
161
  left: "left";
162
- center: "center";
163
162
  right: "right";
163
+ center: "center";
164
164
  justify: "justify";
165
165
  }>>;
166
166
  list: z.ZodOptional<z.ZodObject<{
@@ -307,8 +307,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
307
307
  paragraph: z.ZodOptional<z.ZodObject<{
308
308
  alignment: z.ZodOptional<z.ZodEnum<{
309
309
  left: "left";
310
- center: "center";
311
310
  right: "right";
311
+ center: "center";
312
312
  justify: "justify";
313
313
  }>>;
314
314
  list: z.ZodOptional<z.ZodObject<{
@@ -455,8 +455,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
455
455
  paragraph: z.ZodOptional<z.ZodObject<{
456
456
  alignment: z.ZodOptional<z.ZodEnum<{
457
457
  left: "left";
458
- center: "center";
459
458
  right: "right";
459
+ center: "center";
460
460
  justify: "justify";
461
461
  }>>;
462
462
  list: z.ZodOptional<z.ZodObject<{
@@ -634,8 +634,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
634
634
  paragraph: z.ZodOptional<z.ZodObject<{
635
635
  alignment: z.ZodOptional<z.ZodEnum<{
636
636
  left: "left";
637
- center: "center";
638
637
  right: "right";
638
+ center: "center";
639
639
  justify: "justify";
640
640
  }>>;
641
641
  list: z.ZodOptional<z.ZodObject<{
@@ -1275,8 +1275,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1275
1275
  }, z.core.$strip>>;
1276
1276
  alignment: z.ZodOptional<z.ZodEnum<{
1277
1277
  left: "left";
1278
- center: "center";
1279
1278
  right: "right";
1279
+ center: "center";
1280
1280
  justify: "justify";
1281
1281
  }>>;
1282
1282
  verticalAlignment: z.ZodOptional<z.ZodEnum<{
@@ -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";
1431
1430
  decimal: "decimal";
1432
1431
  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";
1888
1889
  num: "num";
1889
- min: "min";
1890
1890
  max: "max";
1891
- percent: "percent";
1891
+ min: "min";
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";
1934
1935
  num: "num";
1935
- min: "min";
1936
1936
  max: "max";
1937
- percent: "percent";
1937
+ min: "min";
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";
1945
1946
  num: "num";
1946
- min: "min";
1947
1947
  max: "max";
1948
- percent: "percent";
1948
+ min: "min";
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";
1992
1993
  num: "num";
1993
- min: "min";
1994
1994
  max: "max";
1995
- percent: "percent";
1995
+ min: "min";
1996
1996
  percentile: "percentile";
1997
1997
  }>;
1998
1998
  value: z.ZodOptional<z.ZodString>;
package/dist/codec.d.ts CHANGED
@@ -11,8 +11,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
11
11
  paragraph: z.ZodOptional<z.ZodObject<{
12
12
  alignment: z.ZodOptional<z.ZodEnum<{
13
13
  left: "left";
14
- center: "center";
15
14
  right: "right";
15
+ center: "center";
16
16
  justify: "justify";
17
17
  }>>;
18
18
  list: z.ZodOptional<z.ZodObject<{
@@ -159,8 +159,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
159
159
  paragraph: z.ZodOptional<z.ZodObject<{
160
160
  alignment: z.ZodOptional<z.ZodEnum<{
161
161
  left: "left";
162
- center: "center";
163
162
  right: "right";
163
+ center: "center";
164
164
  justify: "justify";
165
165
  }>>;
166
166
  list: z.ZodOptional<z.ZodObject<{
@@ -307,8 +307,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
307
307
  paragraph: z.ZodOptional<z.ZodObject<{
308
308
  alignment: z.ZodOptional<z.ZodEnum<{
309
309
  left: "left";
310
- center: "center";
311
310
  right: "right";
311
+ center: "center";
312
312
  justify: "justify";
313
313
  }>>;
314
314
  list: z.ZodOptional<z.ZodObject<{
@@ -455,8 +455,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
455
455
  paragraph: z.ZodOptional<z.ZodObject<{
456
456
  alignment: z.ZodOptional<z.ZodEnum<{
457
457
  left: "left";
458
- center: "center";
459
458
  right: "right";
459
+ center: "center";
460
460
  justify: "justify";
461
461
  }>>;
462
462
  list: z.ZodOptional<z.ZodObject<{
@@ -634,8 +634,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
634
634
  paragraph: z.ZodOptional<z.ZodObject<{
635
635
  alignment: z.ZodOptional<z.ZodEnum<{
636
636
  left: "left";
637
- center: "center";
638
637
  right: "right";
638
+ center: "center";
639
639
  justify: "justify";
640
640
  }>>;
641
641
  list: z.ZodOptional<z.ZodObject<{
@@ -1275,8 +1275,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
1275
1275
  }, z.core.$strip>>;
1276
1276
  alignment: z.ZodOptional<z.ZodEnum<{
1277
1277
  left: "left";
1278
- center: "center";
1279
1278
  right: "right";
1279
+ center: "center";
1280
1280
  justify: "justify";
1281
1281
  }>>;
1282
1282
  verticalAlignment: z.ZodOptional<z.ZodEnum<{
@@ -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";
1431
1430
  decimal: "decimal";
1432
1431
  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";
1888
1889
  num: "num";
1889
- min: "min";
1890
1890
  max: "max";
1891
- percent: "percent";
1891
+ min: "min";
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";
1934
1935
  num: "num";
1935
- min: "min";
1936
1936
  max: "max";
1937
- percent: "percent";
1937
+ min: "min";
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";
1945
1946
  num: "num";
1946
- min: "min";
1947
1947
  max: "max";
1948
- percent: "percent";
1948
+ min: "min";
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";
1992
1993
  num: "num";
1993
- min: "min";
1994
1994
  max: "max";
1995
- percent: "percent";
1995
+ min: "min";
1996
1996
  percentile: "percentile";
1997
1997
  }>;
1998
1998
  value: z.ZodOptional<z.ZodString>;
@@ -31,7 +31,8 @@ const MarkdownDiagnosticCodes = {
31
31
  HEADING_STYLE_OVERRIDDEN_FOR_LINE_BREAK: "md/heading-style-overridden-for-line-break",
32
32
  LIST_NUMID_FALLBACK: "md/list-numid-fallback",
33
33
  TABLE_CELL_FORMATTING_DROPPED: "md/table-cell-formatting-dropped",
34
- TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined"
34
+ TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined",
35
+ TABLE_CELL_IMAGE_DEGRADED: "md/table-cell-image-degraded"
35
36
  };
36
37
  var MarkdownParseError = class extends Error {
37
38
  code;
@@ -1,2 +1,2 @@
1
- import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, l as MarkdownPackageFlattenError, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "../diagnostics-CnamCy6I.cjs";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, l as MarkdownPackageFlattenError, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "../diagnostics-eL5c8OWm.cjs";
2
2
  export { MarkdownDiagnostic, MarkdownDiagnosticCodes, MarkdownDiagnosticSeverity, MarkdownDiagnosticSink, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownPackageFlattenError, MarkdownParseError, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK };
@@ -1,2 +1,2 @@
1
- import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, l as MarkdownPackageFlattenError, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "../diagnostics-CnamCy6I.js";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, l as MarkdownPackageFlattenError, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "../diagnostics-eL5c8OWm.js";
2
2
  export { MarkdownDiagnostic, MarkdownDiagnosticCodes, MarkdownDiagnosticSeverity, MarkdownDiagnosticSink, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownPackageFlattenError, MarkdownParseError, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK };
@@ -30,7 +30,8 @@ const MarkdownDiagnosticCodes = {
30
30
  HEADING_STYLE_OVERRIDDEN_FOR_LINE_BREAK: "md/heading-style-overridden-for-line-break",
31
31
  LIST_NUMID_FALLBACK: "md/list-numid-fallback",
32
32
  TABLE_CELL_FORMATTING_DROPPED: "md/table-cell-formatting-dropped",
33
- TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined"
33
+ TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined",
34
+ TABLE_CELL_IMAGE_DEGRADED: "md/table-cell-image-degraded"
34
35
  };
35
36
  var MarkdownParseError = class extends Error {
36
37
  code;
@@ -39,6 +39,7 @@ declare const MarkdownDiagnosticCodes: {
39
39
  readonly LIST_NUMID_FALLBACK: "md/list-numid-fallback";
40
40
  readonly TABLE_CELL_FORMATTING_DROPPED: "md/table-cell-formatting-dropped";
41
41
  readonly TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined";
42
+ readonly TABLE_CELL_IMAGE_DEGRADED: "md/table-cell-image-degraded";
42
43
  };
43
44
  declare class MarkdownParseError extends Error {
44
45
  readonly code: string;
@@ -39,6 +39,7 @@ declare const MarkdownDiagnosticCodes: {
39
39
  readonly LIST_NUMID_FALLBACK: "md/list-numid-fallback";
40
40
  readonly TABLE_CELL_FORMATTING_DROPPED: "md/table-cell-formatting-dropped";
41
41
  readonly TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined";
42
+ readonly TABLE_CELL_IMAGE_DEGRADED: "md/table-cell-image-degraded";
42
43
  };
43
44
  declare class MarkdownParseError extends Error {
44
45
  readonly code: string;
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.cjs";
2
2
  import { ContentRun, RunConstructExtent } from "document-schema.js";
3
3
  //#region src/emit/inline.d.ts
4
4
  interface InlineEmitContext {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.js";
2
2
  import { ContentRun, RunConstructExtent } from "document-schema.js";
3
3
  //#region src/emit/inline.d.ts
4
4
  interface InlineEmitContext {
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_diagnostics_diagnostics = require("../diagnostics/diagnostics.cjs");
3
3
  const require_emit_inline = require("./inline.cjs");
4
+ const require_emit_image = require("./image.cjs");
4
5
  //#region src/emit/table.ts
5
6
  function toMarkdownAlignment(alignment) {
6
7
  return alignment === void 0 || alignment === "justify" ? "none" : alignment;
@@ -42,10 +43,19 @@ function renderCellText(cell, context) {
42
43
  if (cell.blocks.length > 1) context.sink({
43
44
  code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.TABLE_CELL_MULTI_PARAGRAPH_JOINED,
44
45
  severity: "info",
45
- message: `a table cell with ${String(cell.blocks.length)} blocks has no multi-paragraph equivalent in a GFM table cell; their own rendered text is space-joined into the one line a cell allows`
46
+ message: `a table cell with ${String(cell.blocks.length)} blocks has no multi-paragraph equivalent in a GFM table cell; their own rendered text is joined with a literal <br> line break`
46
47
  });
47
48
  const parts = [];
48
49
  for (const block of cell.blocks) {
50
+ if (block.kind === "image") {
51
+ context.sink({
52
+ code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.TABLE_CELL_IMAGE_DEGRADED,
53
+ severity: "info",
54
+ message: "a table cell's own image block has no GFM table equivalent; it emits inline instead, degrading on read-back to a run carrying the alt text with the image's data as that run's hyperlink"
55
+ });
56
+ parts.push(require_emit_image.emitImage(block, context.embedImages));
57
+ continue;
58
+ }
49
59
  if (block.kind !== "paragraph") {
50
60
  context.sink({
51
61
  code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.TABLE_CELL_FORMATTING_DROPPED,
@@ -57,7 +67,7 @@ function renderCellText(cell, context) {
57
67
  const text = require_emit_inline.emitRunsSingleLine(block.runs, context, block.constructs);
58
68
  if (text.length > 0) parts.push(text);
59
69
  }
60
- return escapeUnescapedPipes(parts.join(" "));
70
+ return escapeUnescapedPipes(parts.join("<br>"));
61
71
  }
62
72
  function emitTable(table, context) {
63
73
  const [header, ...body] = table.rows;
@@ -1,9 +1,10 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.cjs";
2
2
  import { InlineEmitContext } from "./inline.cjs";
3
3
  import { ContentTable } from "document-schema.js";
4
4
  //#region src/emit/table.d.ts
5
5
  interface TableEmitContext extends InlineEmitContext {
6
6
  readonly sink: MarkdownDiagnosticSink;
7
+ readonly embedImages: boolean;
7
8
  }
8
9
  declare function emitTable(table: ContentTable, context: TableEmitContext): string;
9
10
  //#endregion
@@ -1,9 +1,10 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.js";
2
2
  import { InlineEmitContext } from "./inline.js";
3
3
  import { ContentTable } from "document-schema.js";
4
4
  //#region src/emit/table.d.ts
5
5
  interface TableEmitContext extends InlineEmitContext {
6
6
  readonly sink: MarkdownDiagnosticSink;
7
+ readonly embedImages: boolean;
7
8
  }
8
9
  declare function emitTable(table: ContentTable, context: TableEmitContext): string;
9
10
  //#endregion
@@ -1,5 +1,6 @@
1
1
  import { MarkdownDiagnosticCodes } from "../diagnostics/diagnostics.js";
2
2
  import { emitRunsSingleLine } from "./inline.js";
3
+ import { emitImage } from "./image.js";
3
4
  //#region src/emit/table.ts
4
5
  function toMarkdownAlignment(alignment) {
5
6
  return alignment === void 0 || alignment === "justify" ? "none" : alignment;
@@ -41,10 +42,19 @@ function renderCellText(cell, context) {
41
42
  if (cell.blocks.length > 1) context.sink({
42
43
  code: MarkdownDiagnosticCodes.TABLE_CELL_MULTI_PARAGRAPH_JOINED,
43
44
  severity: "info",
44
- message: `a table cell with ${String(cell.blocks.length)} blocks has no multi-paragraph equivalent in a GFM table cell; their own rendered text is space-joined into the one line a cell allows`
45
+ message: `a table cell with ${String(cell.blocks.length)} blocks has no multi-paragraph equivalent in a GFM table cell; their own rendered text is joined with a literal <br> line break`
45
46
  });
46
47
  const parts = [];
47
48
  for (const block of cell.blocks) {
49
+ if (block.kind === "image") {
50
+ context.sink({
51
+ code: MarkdownDiagnosticCodes.TABLE_CELL_IMAGE_DEGRADED,
52
+ severity: "info",
53
+ message: "a table cell's own image block has no GFM table equivalent; it emits inline instead, degrading on read-back to a run carrying the alt text with the image's data as that run's hyperlink"
54
+ });
55
+ parts.push(emitImage(block, context.embedImages));
56
+ continue;
57
+ }
48
58
  if (block.kind !== "paragraph") {
49
59
  context.sink({
50
60
  code: MarkdownDiagnosticCodes.TABLE_CELL_FORMATTING_DROPPED,
@@ -56,7 +66,7 @@ function renderCellText(cell, context) {
56
66
  const text = emitRunsSingleLine(block.runs, context, block.constructs);
57
67
  if (text.length > 0) parts.push(text);
58
68
  }
59
- return escapeUnescapedPipes(parts.join(" "));
69
+ return escapeUnescapedPipes(parts.join("<br>"));
60
70
  }
61
71
  function emitTable(table, context) {
62
72
  const [header, ...body] = table.rows;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "./diagnostics-CnamCy6I.cjs";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "./diagnostics-eL5c8OWm.cjs";
2
2
  import { MarkdownBytesSchema, markdownCodec, markdownContentCodec } from "./codec.cjs";
3
3
  import { n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "./image-B5L0HpAJ.cjs";
4
4
  import { MarkdownBulletListMarker, MarkdownCodeFenceChar, MarkdownEmphasisMarker, MarkdownHeadingStyle, MarkdownLineEnding, MarkdownOrderedListDelimiter, MarkdownThematicBreakChar, ReadMarkdownOptions, WriteMarkdownOptions, WriteMarkdownStyleOptions } from "./options/options.cjs";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "./diagnostics-CnamCy6I.js";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "./diagnostics-eL5c8OWm.js";
2
2
  import { MarkdownBytesSchema, markdownCodec, markdownContentCodec } from "./codec.js";
3
3
  import { n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "./image-C390OIB3.js";
4
4
  import { MarkdownBulletListMarker, MarkdownCodeFenceChar, MarkdownEmphasisMarker, MarkdownHeadingStyle, MarkdownLineEnding, MarkdownOrderedListDelimiter, MarkdownThematicBreakChar, ReadMarkdownOptions, WriteMarkdownOptions, WriteMarkdownStyleOptions } from "./options/options.js";
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.cjs";
2
2
  import { LayoutMetadata } from "document-schema.js";
3
3
  //#region src/lower/front-matter.d.ts
4
4
  interface FrontMatterResult {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.js";
2
2
  import { LayoutMetadata } from "document-schema.js";
3
3
  //#region src/lower/front-matter.d.ts
4
4
  interface FrontMatterResult {
@@ -1,5 +1,5 @@
1
1
  import { v as MarkdownInlineNode } from "../ast-CNfTgS0N.cjs";
2
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.cjs";
2
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.cjs";
3
3
  import { ContentRun, RunConstructExtent } from "document-schema.js";
4
4
  //#region src/lower/inline.d.ts
5
5
  interface InlineLowerContext {
@@ -1,5 +1,5 @@
1
1
  import { v as MarkdownInlineNode } from "../ast-CNfTgS0N.js";
2
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.js";
2
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.js";
3
3
  import { ContentRun, RunConstructExtent } from "document-schema.js";
4
4
  //#region src/lower/inline.d.ts
5
5
  interface InlineLowerContext {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.cjs";
2
2
  import { n as MarkdownImageResolver } from "../image-B5L0HpAJ.cjs";
3
3
  import { Margins, PageSize } from "document-schema.js";
4
4
  //#region src/options/options.d.ts
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-CnamCy6I.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-eL5c8OWm.js";
2
2
  import { n as MarkdownImageResolver } from "../image-C390OIB3.js";
3
3
  import { Margins, PageSize } from "document-schema.js";
4
4
  //#region src/options/options.d.ts
package/dist/read.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as MarkdownDiagnostic } from "./diagnostics-CnamCy6I.cjs";
1
+ import { t as MarkdownDiagnostic } from "./diagnostics-eL5c8OWm.cjs";
2
2
  import { ReadMarkdownOptions } from "./options/options.cjs";
3
3
  import { ContentDocument, DocumentTree } from "document-schema.js";
4
4
  //#region src/read.d.ts
package/dist/read.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as MarkdownDiagnostic } from "./diagnostics-CnamCy6I.js";
1
+ import { t as MarkdownDiagnostic } from "./diagnostics-eL5c8OWm.js";
2
2
  import { ReadMarkdownOptions } from "./options/options.js";
3
3
  import { ContentDocument, DocumentTree } from "document-schema.js";
4
4
  //#region src/read.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown-codec",
3
- "version": "6.3.7",
3
+ "version": "6.4.0",
4
4
  "description": "Hand-written CommonMark+GFM <-> DocumentTree codec, built on document-schema.js",
5
5
  "type": "module",
6
6
  "repository": {