markdown-codec 10.0.0 → 11.0.1
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/block/block.d.cts +1 -1
- package/dist/block/block.d.ts +1 -1
- package/dist/block/definitions.d.cts +1 -1
- package/dist/block/definitions.d.ts +1 -1
- package/dist/codec.d.cts +8 -8
- package/dist/codec.d.ts +8 -8
- package/dist/diagnostics/diagnostics.cjs +2 -1
- package/dist/diagnostics/diagnostics.d.cts +1 -1
- package/dist/diagnostics/diagnostics.d.ts +1 -1
- package/dist/diagnostics/diagnostics.js +2 -1
- package/dist/{diagnostics-BJtTrxpp.d.cts → diagnostics-DpAXEzZP.d.cts} +1 -0
- package/dist/{diagnostics-BJtTrxpp.d.ts → diagnostics-DpAXEzZP.d.ts} +1 -0
- package/dist/emit/html-table.cjs +6 -2
- package/dist/emit/html-table.js +6 -2
- package/dist/emit/inline.d.cts +1 -1
- package/dist/emit/inline.d.ts +1 -1
- package/dist/emit/table.cjs +5 -0
- package/dist/emit/table.d.cts +2 -2
- package/dist/emit/table.d.ts +2 -2
- package/dist/emit/table.js +5 -0
- package/dist/html/html-table.cjs +9 -3
- package/dist/html/html-table.js +9 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{inline-XJ4cdpPz.d.ts → inline-BJj81pYp.d.ts} +1 -1
- package/dist/{inline-C8ObWyKW.d.cts → inline-DD4bcJFT.d.cts} +1 -1
- package/dist/lower/front-matter.d.cts +1 -1
- package/dist/lower/front-matter.d.ts +1 -1
- package/dist/lower/inline.d.cts +1 -1
- package/dist/lower/inline.d.ts +1 -1
- package/dist/lower/table.cjs +4 -1
- package/dist/lower/table.js +4 -1
- package/dist/options/options.d.cts +1 -1
- package/dist/options/options.d.ts +1 -1
- package/dist/read.d.cts +1 -1
- package/dist/read.d.ts +1 -1
- package/package.json +3 -3
package/dist/block/block.d.cts
CHANGED
|
@@ -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-
|
|
3
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.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
|
package/dist/block/block.d.ts
CHANGED
|
@@ -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-
|
|
3
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.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-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.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-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.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
|
@@ -17,8 +17,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
17
17
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
18
18
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
19
19
|
left: "left";
|
|
20
|
-
right: "right";
|
|
21
20
|
center: "center";
|
|
21
|
+
right: "right";
|
|
22
22
|
justify: "justify";
|
|
23
23
|
}>>;
|
|
24
24
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -172,8 +172,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
172
172
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
173
173
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
174
174
|
left: "left";
|
|
175
|
-
right: "right";
|
|
176
175
|
center: "center";
|
|
176
|
+
right: "right";
|
|
177
177
|
justify: "justify";
|
|
178
178
|
}>>;
|
|
179
179
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -332,8 +332,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
332
332
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
333
333
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
334
334
|
left: "left";
|
|
335
|
-
right: "right";
|
|
336
335
|
center: "center";
|
|
336
|
+
right: "right";
|
|
337
337
|
justify: "justify";
|
|
338
338
|
}>>;
|
|
339
339
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -487,8 +487,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
487
487
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
488
488
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
489
489
|
left: "left";
|
|
490
|
-
right: "right";
|
|
491
490
|
center: "center";
|
|
491
|
+
right: "right";
|
|
492
492
|
justify: "justify";
|
|
493
493
|
}>>;
|
|
494
494
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -701,8 +701,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
701
701
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
702
702
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
703
703
|
left: "left";
|
|
704
|
-
right: "right";
|
|
705
704
|
center: "center";
|
|
705
|
+
right: "right";
|
|
706
706
|
justify: "justify";
|
|
707
707
|
}>>;
|
|
708
708
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -1538,8 +1538,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1538
1538
|
}, z.core.$strip>>;
|
|
1539
1539
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
1540
1540
|
left: "left";
|
|
1541
|
-
right: "right";
|
|
1542
1541
|
center: "center";
|
|
1542
|
+
right: "right";
|
|
1543
1543
|
justify: "justify";
|
|
1544
1544
|
}>>;
|
|
1545
1545
|
verticalAlignment: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1681,10 +1681,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1681
1681
|
}>;
|
|
1682
1682
|
align: z.ZodEnum<{
|
|
1683
1683
|
left: "left";
|
|
1684
|
+
center: "center";
|
|
1684
1685
|
right: "right";
|
|
1685
1686
|
top: "top";
|
|
1686
1687
|
bottom: "bottom";
|
|
1687
|
-
center: "center";
|
|
1688
1688
|
inside: "inside";
|
|
1689
1689
|
outside: "outside";
|
|
1690
1690
|
}>;
|
|
@@ -1724,10 +1724,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1724
1724
|
}>;
|
|
1725
1725
|
align: z.ZodEnum<{
|
|
1726
1726
|
left: "left";
|
|
1727
|
+
center: "center";
|
|
1727
1728
|
right: "right";
|
|
1728
1729
|
top: "top";
|
|
1729
1730
|
bottom: "bottom";
|
|
1730
|
-
center: "center";
|
|
1731
1731
|
inside: "inside";
|
|
1732
1732
|
outside: "outside";
|
|
1733
1733
|
}>;
|
package/dist/codec.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
17
17
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
18
18
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
19
19
|
left: "left";
|
|
20
|
-
right: "right";
|
|
21
20
|
center: "center";
|
|
21
|
+
right: "right";
|
|
22
22
|
justify: "justify";
|
|
23
23
|
}>>;
|
|
24
24
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -172,8 +172,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
172
172
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
173
173
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
174
174
|
left: "left";
|
|
175
|
-
right: "right";
|
|
176
175
|
center: "center";
|
|
176
|
+
right: "right";
|
|
177
177
|
justify: "justify";
|
|
178
178
|
}>>;
|
|
179
179
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -332,8 +332,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
332
332
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
333
333
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
334
334
|
left: "left";
|
|
335
|
-
right: "right";
|
|
336
335
|
center: "center";
|
|
336
|
+
right: "right";
|
|
337
337
|
justify: "justify";
|
|
338
338
|
}>>;
|
|
339
339
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -487,8 +487,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
487
487
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
488
488
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
489
489
|
left: "left";
|
|
490
|
-
right: "right";
|
|
491
490
|
center: "center";
|
|
491
|
+
right: "right";
|
|
492
492
|
justify: "justify";
|
|
493
493
|
}>>;
|
|
494
494
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -701,8 +701,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
701
701
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
702
702
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
703
703
|
left: "left";
|
|
704
|
-
right: "right";
|
|
705
704
|
center: "center";
|
|
705
|
+
right: "right";
|
|
706
706
|
justify: "justify";
|
|
707
707
|
}>>;
|
|
708
708
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -1538,8 +1538,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1538
1538
|
}, z.core.$strip>>;
|
|
1539
1539
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
1540
1540
|
left: "left";
|
|
1541
|
-
right: "right";
|
|
1542
1541
|
center: "center";
|
|
1542
|
+
right: "right";
|
|
1543
1543
|
justify: "justify";
|
|
1544
1544
|
}>>;
|
|
1545
1545
|
verticalAlignment: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1681,10 +1681,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1681
1681
|
}>;
|
|
1682
1682
|
align: z.ZodEnum<{
|
|
1683
1683
|
left: "left";
|
|
1684
|
+
center: "center";
|
|
1684
1685
|
right: "right";
|
|
1685
1686
|
top: "top";
|
|
1686
1687
|
bottom: "bottom";
|
|
1687
|
-
center: "center";
|
|
1688
1688
|
inside: "inside";
|
|
1689
1689
|
outside: "outside";
|
|
1690
1690
|
}>;
|
|
@@ -1724,10 +1724,10 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1724
1724
|
}>;
|
|
1725
1725
|
align: z.ZodEnum<{
|
|
1726
1726
|
left: "left";
|
|
1727
|
+
center: "center";
|
|
1727
1728
|
right: "right";
|
|
1728
1729
|
top: "top";
|
|
1729
1730
|
bottom: "bottom";
|
|
1730
|
-
center: "center";
|
|
1731
1731
|
inside: "inside";
|
|
1732
1732
|
outside: "outside";
|
|
1733
1733
|
}>;
|
|
@@ -32,7 +32,8 @@ const MarkdownDiagnosticCodes = {
|
|
|
32
32
|
TABLE_CELL_FORMATTING_DROPPED: "md/table-cell-formatting-dropped",
|
|
33
33
|
TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined",
|
|
34
34
|
TABLE_CELL_IMAGE_DEGRADED: "md/table-cell-image-degraded",
|
|
35
|
-
TABLE_HTML_FALLBACK: "md/table-html-fallback"
|
|
35
|
+
TABLE_HTML_FALLBACK: "md/table-html-fallback",
|
|
36
|
+
TABLE_HEADER_ROW_SYNTHESISED: "md/table-header-row-synthesised"
|
|
36
37
|
};
|
|
37
38
|
var MarkdownParseError = class extends Error {
|
|
38
39
|
code;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MarkdownInputTooLargeError, c as MarkdownPackageFlattenError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUndecodableTextError, h as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownParseError, m as MarkdownWriteError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownUnsupportedDocumentKindError, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownTableGridFaultError } from "../diagnostics-
|
|
1
|
+
import { a as MarkdownInputTooLargeError, c as MarkdownPackageFlattenError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUndecodableTextError, h as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownParseError, m as MarkdownWriteError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownUnsupportedDocumentKindError, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownTableGridFaultError } from "../diagnostics-DpAXEzZP.cjs";
|
|
2
2
|
export { MarkdownDiagnostic, MarkdownDiagnosticCodes, MarkdownDiagnosticSeverity, MarkdownDiagnosticSink, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownNestingLimitExceededError, MarkdownPackageFlattenError, MarkdownParseError, MarkdownTableGridFaultError, MarkdownUnbalancedConstructMarkersError, MarkdownUndecodableTextError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MarkdownInputTooLargeError, c as MarkdownPackageFlattenError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUndecodableTextError, h as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownParseError, m as MarkdownWriteError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownUnsupportedDocumentKindError, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownTableGridFaultError } from "../diagnostics-
|
|
1
|
+
import { a as MarkdownInputTooLargeError, c as MarkdownPackageFlattenError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUndecodableTextError, h as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownParseError, m as MarkdownWriteError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownUnsupportedDocumentKindError, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownTableGridFaultError } from "../diagnostics-DpAXEzZP.js";
|
|
2
2
|
export { MarkdownDiagnostic, MarkdownDiagnosticCodes, MarkdownDiagnosticSeverity, MarkdownDiagnosticSink, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownNestingLimitExceededError, MarkdownPackageFlattenError, MarkdownParseError, MarkdownTableGridFaultError, MarkdownUnbalancedConstructMarkersError, MarkdownUndecodableTextError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK };
|
|
@@ -31,7 +31,8 @@ const MarkdownDiagnosticCodes = {
|
|
|
31
31
|
TABLE_CELL_FORMATTING_DROPPED: "md/table-cell-formatting-dropped",
|
|
32
32
|
TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined",
|
|
33
33
|
TABLE_CELL_IMAGE_DEGRADED: "md/table-cell-image-degraded",
|
|
34
|
-
TABLE_HTML_FALLBACK: "md/table-html-fallback"
|
|
34
|
+
TABLE_HTML_FALLBACK: "md/table-html-fallback",
|
|
35
|
+
TABLE_HEADER_ROW_SYNTHESISED: "md/table-header-row-synthesised"
|
|
35
36
|
};
|
|
36
37
|
var MarkdownParseError = class extends Error {
|
|
37
38
|
code;
|
|
@@ -40,6 +40,7 @@ declare const MarkdownDiagnosticCodes: {
|
|
|
40
40
|
readonly TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined";
|
|
41
41
|
readonly TABLE_CELL_IMAGE_DEGRADED: "md/table-cell-image-degraded";
|
|
42
42
|
readonly TABLE_HTML_FALLBACK: "md/table-html-fallback";
|
|
43
|
+
readonly TABLE_HEADER_ROW_SYNTHESISED: "md/table-header-row-synthesised";
|
|
43
44
|
};
|
|
44
45
|
declare class MarkdownParseError extends Error {
|
|
45
46
|
readonly code: string;
|
|
@@ -40,6 +40,7 @@ declare const MarkdownDiagnosticCodes: {
|
|
|
40
40
|
readonly TABLE_CELL_MULTI_PARAGRAPH_JOINED: "md/table-cell-multi-paragraph-joined";
|
|
41
41
|
readonly TABLE_CELL_IMAGE_DEGRADED: "md/table-cell-image-degraded";
|
|
42
42
|
readonly TABLE_HTML_FALLBACK: "md/table-html-fallback";
|
|
43
|
+
readonly TABLE_HEADER_ROW_SYNTHESISED: "md/table-header-row-synthesised";
|
|
43
44
|
};
|
|
44
45
|
declare class MarkdownParseError extends Error {
|
|
45
46
|
readonly code: string;
|
package/dist/emit/html-table.cjs
CHANGED
|
@@ -12,8 +12,11 @@ function escapeHtmlAttribute(text) {
|
|
|
12
12
|
function blockNeedsHtmlFallback(block) {
|
|
13
13
|
return block.kind !== "paragraph" && block.kind !== "image";
|
|
14
14
|
}
|
|
15
|
+
function headerRowsNeedHtmlFallback(table) {
|
|
16
|
+
return table.rows.some((row, index) => row.isHeader === true && index > 0);
|
|
17
|
+
}
|
|
15
18
|
function tableNeedsHtmlFallback(table) {
|
|
16
|
-
return table.rows.some((row) => row.cells.some((cell) => cell.colSpan !== void 0 || cell.rowSpan !== void 0 || cell.background !== void 0 || cell.blocks.some(blockNeedsHtmlFallback)));
|
|
19
|
+
return headerRowsNeedHtmlFallback(table) || table.rows.some((row) => row.cells.some((cell) => cell.colSpan !== void 0 || cell.rowSpan !== void 0 || cell.background !== void 0 || cell.blocks.some(blockNeedsHtmlFallback)));
|
|
17
20
|
}
|
|
18
21
|
function emitRunHtml(run) {
|
|
19
22
|
let text = escapeHtmlText(run.text);
|
|
@@ -103,7 +106,8 @@ function emitHtmlTable(table, context) {
|
|
|
103
106
|
return [
|
|
104
107
|
"<table>",
|
|
105
108
|
...(0, document_schema_js.walkTableGrid)(table).map((positions, rowIndex) => {
|
|
106
|
-
|
|
109
|
+
const isHeader = table.rows[rowIndex].isHeader === true;
|
|
110
|
+
return `<tr>${positions.flatMap((position) => position.anchorRowIndex === void 0 ? [emitCellTag(position.cell, isHeader, context)] : []).join("")}</tr>`;
|
|
107
111
|
}),
|
|
108
112
|
"</table>"
|
|
109
113
|
].join("\n");
|
package/dist/emit/html-table.js
CHANGED
|
@@ -11,8 +11,11 @@ function escapeHtmlAttribute(text) {
|
|
|
11
11
|
function blockNeedsHtmlFallback(block) {
|
|
12
12
|
return block.kind !== "paragraph" && block.kind !== "image";
|
|
13
13
|
}
|
|
14
|
+
function headerRowsNeedHtmlFallback(table) {
|
|
15
|
+
return table.rows.some((row, index) => row.isHeader === true && index > 0);
|
|
16
|
+
}
|
|
14
17
|
function tableNeedsHtmlFallback(table) {
|
|
15
|
-
return table.rows.some((row) => row.cells.some((cell) => cell.colSpan !== void 0 || cell.rowSpan !== void 0 || cell.background !== void 0 || cell.blocks.some(blockNeedsHtmlFallback)));
|
|
18
|
+
return headerRowsNeedHtmlFallback(table) || table.rows.some((row) => row.cells.some((cell) => cell.colSpan !== void 0 || cell.rowSpan !== void 0 || cell.background !== void 0 || cell.blocks.some(blockNeedsHtmlFallback)));
|
|
16
19
|
}
|
|
17
20
|
function emitRunHtml(run) {
|
|
18
21
|
let text = escapeHtmlText(run.text);
|
|
@@ -102,7 +105,8 @@ function emitHtmlTable(table, context) {
|
|
|
102
105
|
return [
|
|
103
106
|
"<table>",
|
|
104
107
|
...walkTableGrid(table).map((positions, rowIndex) => {
|
|
105
|
-
|
|
108
|
+
const isHeader = table.rows[rowIndex].isHeader === true;
|
|
109
|
+
return `<tr>${positions.flatMap((position) => position.anchorRowIndex === void 0 ? [emitCellTag(position.cell, isHeader, context)] : []).join("")}</tr>`;
|
|
106
110
|
}),
|
|
107
111
|
"</table>"
|
|
108
112
|
].join("\n");
|
package/dist/emit/inline.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as escapeMarkdownText, i as escapeLinkDestination, n as emitRuns, o as renderLinkTitle, r as emitRunsSingleLine, t as InlineEmitContext } from "../inline-
|
|
1
|
+
import { a as escapeMarkdownText, i as escapeLinkDestination, n as emitRuns, o as renderLinkTitle, r as emitRunsSingleLine, t as InlineEmitContext } from "../inline-DD4bcJFT.cjs";
|
|
2
2
|
export { InlineEmitContext, emitRuns, emitRunsSingleLine, escapeLinkDestination, escapeMarkdownText, renderLinkTitle };
|
package/dist/emit/inline.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as escapeMarkdownText, i as escapeLinkDestination, n as emitRuns, o as renderLinkTitle, r as emitRunsSingleLine, t as InlineEmitContext } from "../inline-
|
|
1
|
+
import { a as escapeMarkdownText, i as escapeLinkDestination, n as emitRuns, o as renderLinkTitle, r as emitRunsSingleLine, t as InlineEmitContext } from "../inline-BJj81pYp.js";
|
|
2
2
|
export { InlineEmitContext, emitRuns, emitRunsSingleLine, escapeLinkDestination, escapeMarkdownText, renderLinkTitle };
|
package/dist/emit/table.cjs
CHANGED
|
@@ -70,6 +70,11 @@ function emitTable(table, context) {
|
|
|
70
70
|
require_emit_html_table.assertTableObeysGridRule(table);
|
|
71
71
|
const [header, ...body] = table.rows;
|
|
72
72
|
if (header === void 0) return "";
|
|
73
|
+
if (header.isHeader !== true) context.sink({
|
|
74
|
+
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.TABLE_HEADER_ROW_SYNTHESISED,
|
|
75
|
+
severity: "info",
|
|
76
|
+
message: "this table states no header row, and GFM's own table extension has no syntax for a table without one (github.github.com/gfm, \"Tables (extension)\"), so its first row is rendered as the header row and will read back as one"
|
|
77
|
+
});
|
|
73
78
|
const alignments = header.cells.map((cell) => toMarkdownAlignment(cell.blocks[0]?.kind === "paragraph" ? cell.blocks[0].alignment : void 0));
|
|
74
79
|
return [
|
|
75
80
|
`| ${header.cells.map((cell) => renderCellText(cell, context)).join(" | ")} |`,
|
package/dist/emit/table.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
2
|
-
import { t as InlineEmitContext } from "../inline-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.cjs";
|
|
2
|
+
import { t as InlineEmitContext } from "../inline-DD4bcJFT.cjs";
|
|
3
3
|
import { ContentTable } from "document-schema.js";
|
|
4
4
|
//#region src/emit/table.d.ts
|
|
5
5
|
interface TableEmitContext extends InlineEmitContext {
|
package/dist/emit/table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
2
|
-
import { t as InlineEmitContext } from "../inline-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.js";
|
|
2
|
+
import { t as InlineEmitContext } from "../inline-BJj81pYp.js";
|
|
3
3
|
import { ContentTable } from "document-schema.js";
|
|
4
4
|
//#region src/emit/table.d.ts
|
|
5
5
|
interface TableEmitContext extends InlineEmitContext {
|
package/dist/emit/table.js
CHANGED
|
@@ -69,6 +69,11 @@ function emitTable(table, context) {
|
|
|
69
69
|
assertTableObeysGridRule(table);
|
|
70
70
|
const [header, ...body] = table.rows;
|
|
71
71
|
if (header === void 0) return "";
|
|
72
|
+
if (header.isHeader !== true) context.sink({
|
|
73
|
+
code: MarkdownDiagnosticCodes.TABLE_HEADER_ROW_SYNTHESISED,
|
|
74
|
+
severity: "info",
|
|
75
|
+
message: "this table states no header row, and GFM's own table extension has no syntax for a table without one (github.github.com/gfm, \"Tables (extension)\"), so its first row is rendered as the header row and will read back as one"
|
|
76
|
+
});
|
|
72
77
|
const alignments = header.cells.map((cell) => toMarkdownAlignment(cell.blocks[0]?.kind === "paragraph" ? cell.blocks[0].alignment : void 0));
|
|
73
78
|
return [
|
|
74
79
|
`| ${header.cells.map((cell) => renderCellText(cell, context)).join(" | ")} |`,
|
package/dist/html/html-table.cjs
CHANGED
|
@@ -25,7 +25,7 @@ function findBalancedClose(text, openEnd, tagNames) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
function extractTopLevelElements(text, tagNames) {
|
|
28
|
-
const openPattern = new RegExp(`<(
|
|
28
|
+
const openPattern = new RegExp(`<(${tagNames.join("|")})\\b([^>]*)>`, "gi");
|
|
29
29
|
const elements = [];
|
|
30
30
|
let pos = 0;
|
|
31
31
|
for (;;) {
|
|
@@ -33,11 +33,13 @@ function extractTopLevelElements(text, tagNames) {
|
|
|
33
33
|
const match = openPattern.exec(text);
|
|
34
34
|
if (match === null) break;
|
|
35
35
|
if (text.slice(pos, match.index).trim().length > 0) return;
|
|
36
|
-
const
|
|
36
|
+
const tag = match[1].toLowerCase();
|
|
37
|
+
const attrs = match[2];
|
|
37
38
|
const openEnd = match.index + match[0].length;
|
|
38
39
|
const close = findBalancedClose(text, openEnd, tagNames);
|
|
39
40
|
if (close === void 0) return;
|
|
40
41
|
elements.push({
|
|
42
|
+
tag,
|
|
41
43
|
attrs,
|
|
42
44
|
inner: text.slice(openEnd, close.start)
|
|
43
45
|
});
|
|
@@ -210,7 +212,11 @@ function parseTableRows(inner, contentWidthPt) {
|
|
|
210
212
|
for (const row of rowElements) {
|
|
211
213
|
const cellElements = extractTopLevelElements(row.inner, ["td", "th"]);
|
|
212
214
|
if (cellElements === void 0 || cellElements.length === 0) return;
|
|
213
|
-
|
|
215
|
+
const isHeader = cellElements.every((cell) => cell.tag === "th");
|
|
216
|
+
anchorRows.push({
|
|
217
|
+
cells: cellElements.map((cell) => buildCell(cell, contentWidthPt)),
|
|
218
|
+
...isHeader ? { isHeader: true } : {}
|
|
219
|
+
});
|
|
214
220
|
}
|
|
215
221
|
return (0, document_schema_js.placeAnchorTableRows)(anchorRows, NO_DECLARED_COLUMN_COUNT);
|
|
216
222
|
}
|
package/dist/html/html-table.js
CHANGED
|
@@ -24,7 +24,7 @@ function findBalancedClose(text, openEnd, tagNames) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function extractTopLevelElements(text, tagNames) {
|
|
27
|
-
const openPattern = new RegExp(`<(
|
|
27
|
+
const openPattern = new RegExp(`<(${tagNames.join("|")})\\b([^>]*)>`, "gi");
|
|
28
28
|
const elements = [];
|
|
29
29
|
let pos = 0;
|
|
30
30
|
for (;;) {
|
|
@@ -32,11 +32,13 @@ function extractTopLevelElements(text, tagNames) {
|
|
|
32
32
|
const match = openPattern.exec(text);
|
|
33
33
|
if (match === null) break;
|
|
34
34
|
if (text.slice(pos, match.index).trim().length > 0) return;
|
|
35
|
-
const
|
|
35
|
+
const tag = match[1].toLowerCase();
|
|
36
|
+
const attrs = match[2];
|
|
36
37
|
const openEnd = match.index + match[0].length;
|
|
37
38
|
const close = findBalancedClose(text, openEnd, tagNames);
|
|
38
39
|
if (close === void 0) return;
|
|
39
40
|
elements.push({
|
|
41
|
+
tag,
|
|
40
42
|
attrs,
|
|
41
43
|
inner: text.slice(openEnd, close.start)
|
|
42
44
|
});
|
|
@@ -209,7 +211,11 @@ function parseTableRows(inner, contentWidthPt) {
|
|
|
209
211
|
for (const row of rowElements) {
|
|
210
212
|
const cellElements = extractTopLevelElements(row.inner, ["td", "th"]);
|
|
211
213
|
if (cellElements === void 0 || cellElements.length === 0) return;
|
|
212
|
-
|
|
214
|
+
const isHeader = cellElements.every((cell) => cell.tag === "th");
|
|
215
|
+
anchorRows.push({
|
|
216
|
+
cells: cellElements.map((cell) => buildCell(cell, contentWidthPt)),
|
|
217
|
+
...isHeader ? { isHeader: true } : {}
|
|
218
|
+
});
|
|
213
219
|
}
|
|
214
220
|
return placeAnchorTableRows(anchorRows, NO_DECLARED_COLUMN_COUNT);
|
|
215
221
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MarkdownInputTooLargeError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUndecodableTextError, h as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownParseError, m as MarkdownWriteError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownUnsupportedDocumentKindError, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownTableGridFaultError } from "./diagnostics-
|
|
1
|
+
import { a as MarkdownInputTooLargeError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUndecodableTextError, h as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownParseError, m as MarkdownWriteError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownUnsupportedDocumentKindError, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownTableGridFaultError } from "./diagnostics-DpAXEzZP.cjs";
|
|
2
2
|
import { MarkdownBytesSchema, markdownCodec, markdownContentCodec } from "./codec.cjs";
|
|
3
3
|
import { n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "./image-B6p0Ovgy.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, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUndecodableTextError, h as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownParseError, m as MarkdownWriteError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownUnsupportedDocumentKindError, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownTableGridFaultError } from "./diagnostics-
|
|
1
|
+
import { a as MarkdownInputTooLargeError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUndecodableTextError, h as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownParseError, m as MarkdownWriteError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownUnsupportedDocumentKindError, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownTableGridFaultError } from "./diagnostics-DpAXEzZP.js";
|
|
2
2
|
import { MarkdownBytesSchema, markdownCodec, markdownContentCodec } from "./codec.js";
|
|
3
3
|
import { n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "./image-gR1vISI0.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-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "./diagnostics-DpAXEzZP.js";
|
|
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-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "./diagnostics-DpAXEzZP.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-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.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-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.js";
|
|
2
2
|
import { LayoutMetadata } from "document-schema.js";
|
|
3
3
|
//#region src/lower/front-matter.d.ts
|
|
4
4
|
interface FrontMatterResult {
|
package/dist/lower/inline.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as MarkdownInlineNode } from "../ast-CNfTgS0N.cjs";
|
|
2
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
2
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.cjs";
|
|
3
3
|
import { ContentRun, RunConstructExtent } from "document-schema.js";
|
|
4
4
|
//#region src/lower/inline.d.ts
|
|
5
5
|
interface InlineLowerContext {
|
package/dist/lower/inline.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as MarkdownInlineNode } from "../ast-CNfTgS0N.js";
|
|
2
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
2
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.js";
|
|
3
3
|
import { ContentRun, RunConstructExtent } from "document-schema.js";
|
|
4
4
|
//#region src/lower/inline.d.ts
|
|
5
5
|
interface InlineLowerContext {
|
package/dist/lower/table.cjs
CHANGED
|
@@ -20,7 +20,10 @@ function lowerTable(node, contentWidthPt, context) {
|
|
|
20
20
|
const columnWidthsPt = Array.from({ length: columnCount }, () => contentWidthPt / columnCount);
|
|
21
21
|
return {
|
|
22
22
|
kind: "table",
|
|
23
|
-
rows: node.children.map((row
|
|
23
|
+
rows: node.children.map((row, rowIndex) => ({
|
|
24
|
+
cells: row.children.map((cell, index) => lowerTableCell(cell, node.alignments[index], context)),
|
|
25
|
+
...rowIndex === 0 ? { isHeader: true } : {}
|
|
26
|
+
})),
|
|
24
27
|
columnWidthsPt
|
|
25
28
|
};
|
|
26
29
|
}
|
package/dist/lower/table.js
CHANGED
|
@@ -19,7 +19,10 @@ function lowerTable(node, contentWidthPt, context) {
|
|
|
19
19
|
const columnWidthsPt = Array.from({ length: columnCount }, () => contentWidthPt / columnCount);
|
|
20
20
|
return {
|
|
21
21
|
kind: "table",
|
|
22
|
-
rows: node.children.map((row
|
|
22
|
+
rows: node.children.map((row, rowIndex) => ({
|
|
23
|
+
cells: row.children.map((cell, index) => lowerTableCell(cell, node.alignments[index], context)),
|
|
24
|
+
...rowIndex === 0 ? { isHeader: true } : {}
|
|
25
|
+
})),
|
|
23
26
|
columnWidthsPt
|
|
24
27
|
};
|
|
25
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.cjs";
|
|
2
2
|
import { n as MarkdownImageResolver } from "../image-B6p0Ovgy.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-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-DpAXEzZP.js";
|
|
2
2
|
import { n as MarkdownImageResolver } from "../image-gR1vISI0.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-
|
|
1
|
+
import { t as MarkdownDiagnostic } from "./diagnostics-DpAXEzZP.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-
|
|
1
|
+
import { t as MarkdownDiagnostic } from "./diagnostics-DpAXEzZP.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": "
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "Hand-written CommonMark+GFM <-> DocumentTree codec, built on document-schema.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"license": "MIT",
|
|
84
84
|
"packageManager": "pnpm@12.4.1+sha512.2e81e399d73fe8390dab25e06aa788ab7a5908248d2f5a370f82b481147a6a7a367bf8048f9a6fdb6460f21a66f0542dedb8b94ca2c8723596741920b1656d4c",
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"byte-codec": "1.
|
|
87
|
-
"document-schema.js": "7.
|
|
86
|
+
"byte-codec": "1.8.0",
|
|
87
|
+
"document-schema.js": "7.14.0",
|
|
88
88
|
"zod": "4.4.3"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|