markdown-codec 5.0.3 → 6.1.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 +36 -35
- package/dist/ast/ast.d.cts +1 -1
- package/dist/ast/ast.d.ts +1 -1
- package/dist/{ast-8XCbjRQT.d.cts → ast-CNfTgS0N.d.cts} +35 -35
- package/dist/{ast-8XCbjRQT.d.ts → ast-CNfTgS0N.d.ts} +35 -35
- package/dist/block/block.d.cts +3 -3
- package/dist/block/block.d.ts +3 -3
- package/dist/block/definitions.d.cts +1 -1
- package/dist/block/definitions.d.ts +1 -1
- package/dist/block/node.d.cts +4 -4
- package/dist/block/node.d.ts +4 -4
- package/dist/block/table.d.cts +1 -1
- package/dist/block/table.d.ts +1 -1
- package/dist/codec.cjs +1 -1
- package/dist/codec.d.cts +10 -10
- package/dist/codec.d.ts +10 -10
- package/dist/codec.js +2 -2
- package/dist/defaults/defaults.d.cts +1 -1
- package/dist/defaults/defaults.d.ts +1 -1
- package/dist/diagnostics/diagnostics.d.cts +1 -1
- package/dist/diagnostics/diagnostics.d.ts +1 -1
- package/dist/{diagnostics-CkcSYZf1.d.cts → diagnostics-CH-xa2-s.d.cts} +5 -5
- package/dist/{diagnostics-CkcSYZf1.d.ts → diagnostics-CH-xa2-s.d.ts} +5 -5
- package/dist/emit/emit.cjs +1 -1
- package/dist/emit/emit.js +1 -1
- package/dist/emit/inline.cjs +2 -2
- package/dist/emit/inline.d.cts +3 -3
- package/dist/emit/inline.d.ts +3 -3
- package/dist/emit/inline.js +2 -2
- package/dist/emit/table.d.cts +1 -1
- package/dist/emit/table.d.ts +1 -1
- package/dist/html/render.d.cts +1 -1
- package/dist/html/render.d.ts +1 -1
- package/dist/image/image.cjs +4 -4
- package/dist/image/image.d.cts +1 -1
- package/dist/image/image.d.ts +1 -1
- package/dist/image/image.js +4 -4
- package/dist/{image-C4KYmz_L.d.cts → image-B5L0HpAJ.d.cts} +1 -1
- package/dist/{image-DescdRgq.d.cts → image-BtmTG4_a.d.cts} +1 -1
- package/dist/{image-DescdRgq.d.ts → image-BtmTG4_a.d.ts} +1 -1
- package/dist/{image-Cm3hT5PS.d.ts → image-C390OIB3.d.ts} +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/inline/delimiter.d.cts +2 -2
- package/dist/inline/delimiter.d.ts +2 -2
- package/dist/inline/inline.d.cts +1 -1
- package/dist/inline/inline.d.ts +1 -1
- package/dist/inline/node.d.cts +2 -2
- package/dist/inline/node.d.ts +2 -2
- package/dist/{inline-CoS1JzxI.d.cts → inline-CnO86zMw.d.cts} +1 -1
- package/dist/{inline-OGXVE6hB.d.ts → inline-DItZ-VVw.d.ts} +1 -1
- package/dist/lower/front-matter.d.cts +1 -1
- package/dist/lower/front-matter.d.ts +1 -1
- package/dist/lower/image.d.cts +1 -1
- package/dist/lower/image.d.ts +1 -1
- package/dist/lower/inline.d.cts +3 -3
- package/dist/lower/inline.d.ts +3 -3
- package/dist/lower/table.d.cts +1 -1
- package/dist/lower/table.d.ts +1 -1
- package/dist/options/options.d.cts +10 -10
- package/dist/options/options.d.ts +10 -10
- package/dist/read.cjs +1 -1
- package/dist/read.d.cts +3 -3
- package/dist/read.d.ts +3 -3
- package/dist/read.js +2 -2
- package/dist/scan/entity-table.cjs +2125 -2125
- package/dist/scan/entity-table.js +2125 -2125
- package/dist/shared/list-id.d.cts +3 -3
- package/dist/shared/list-id.d.ts +3 -3
- package/dist/write.cjs +2 -2
- package/dist/write.d.cts +2 -2
- package/dist/write.d.ts +2 -2
- package/dist/write.js +3 -3
- package/package.json +3 -12
package/dist/block/block.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { s as MarkdownDocumentNode } from "../ast-
|
|
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-CH-xa2-s.js";
|
|
4
4
|
import { LinkReferenceMap } from "../inline/link.js";
|
|
5
|
-
import { t as InlineParseOptions } from "../inline-
|
|
5
|
+
import { t as InlineParseOptions } from "../inline-DItZ-VVw.js";
|
|
6
6
|
//#region src/block/block.d.ts
|
|
7
7
|
interface MarkdownParseOptions extends InlineParseOptions {
|
|
8
8
|
readonly gfmTables?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CH-xa2-s.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-CH-xa2-s.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/block/node.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as MarkdownOrderedListDelimiter, N as MarkdownTableAlignment, i as MarkdownBulletMarker } from "../ast-
|
|
1
|
+
import { E as MarkdownOrderedListDelimiter, N as MarkdownTableAlignment, i as MarkdownBulletMarker } from "../ast-CNfTgS0N.cjs";
|
|
2
2
|
import { t as HtmlBlockType } from "../html-bkz2QTuq.cjs";
|
|
3
3
|
//#region src/block/node.d.ts
|
|
4
|
-
type BlockNodeKind =
|
|
4
|
+
type BlockNodeKind = "document" | "paragraph" | "heading" | "blockquote" | "list" | "listItem" | "codeBlock" | "htmlBlock" | "thematicBreak" | "table" | "mathBlock" | "footnoteDefinition";
|
|
5
5
|
type BlockHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
6
|
interface ListMarkerData {
|
|
7
|
-
readonly type:
|
|
7
|
+
readonly type: "bullet" | "ordered";
|
|
8
8
|
readonly bulletChar?: MarkdownBulletMarker;
|
|
9
9
|
readonly delimiter?: MarkdownOrderedListDelimiter;
|
|
10
10
|
readonly start?: number;
|
|
@@ -23,7 +23,7 @@ declare class BlockNode {
|
|
|
23
23
|
level: BlockHeadingLevel;
|
|
24
24
|
setext: boolean;
|
|
25
25
|
fenced: boolean;
|
|
26
|
-
fenceChar:
|
|
26
|
+
fenceChar: "`" | "~";
|
|
27
27
|
fenceLength: number;
|
|
28
28
|
fenceOffset: number;
|
|
29
29
|
infoString: string;
|
package/dist/block/node.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as MarkdownOrderedListDelimiter, N as MarkdownTableAlignment, i as MarkdownBulletMarker } from "../ast-
|
|
1
|
+
import { E as MarkdownOrderedListDelimiter, N as MarkdownTableAlignment, i as MarkdownBulletMarker } from "../ast-CNfTgS0N.js";
|
|
2
2
|
import { t as HtmlBlockType } from "../html-bkz2QTuq.js";
|
|
3
3
|
//#region src/block/node.d.ts
|
|
4
|
-
type BlockNodeKind =
|
|
4
|
+
type BlockNodeKind = "document" | "paragraph" | "heading" | "blockquote" | "list" | "listItem" | "codeBlock" | "htmlBlock" | "thematicBreak" | "table" | "mathBlock" | "footnoteDefinition";
|
|
5
5
|
type BlockHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
6
|
interface ListMarkerData {
|
|
7
|
-
readonly type:
|
|
7
|
+
readonly type: "bullet" | "ordered";
|
|
8
8
|
readonly bulletChar?: MarkdownBulletMarker;
|
|
9
9
|
readonly delimiter?: MarkdownOrderedListDelimiter;
|
|
10
10
|
readonly start?: number;
|
|
@@ -23,7 +23,7 @@ declare class BlockNode {
|
|
|
23
23
|
level: BlockHeadingLevel;
|
|
24
24
|
setext: boolean;
|
|
25
25
|
fenced: boolean;
|
|
26
|
-
fenceChar:
|
|
26
|
+
fenceChar: "`" | "~";
|
|
27
27
|
fenceLength: number;
|
|
28
28
|
fenceOffset: number;
|
|
29
29
|
infoString: string;
|
package/dist/block/table.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as MarkdownTableAlignment } from "../ast-
|
|
1
|
+
import { N as MarkdownTableAlignment } from "../ast-CNfTgS0N.cjs";
|
|
2
2
|
//#region src/block/table.d.ts
|
|
3
3
|
declare function splitTableRow(line: string): string[];
|
|
4
4
|
declare function parseTableDelimiterRow(line: string): MarkdownTableAlignment[] | undefined;
|
package/dist/block/table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as MarkdownTableAlignment } from "../ast-
|
|
1
|
+
import { N as MarkdownTableAlignment } from "../ast-CNfTgS0N.js";
|
|
2
2
|
//#region src/block/table.d.ts
|
|
3
3
|
declare function splitTableRow(line: string): string[];
|
|
4
4
|
declare function parseTableDelimiterRow(line: string): MarkdownTableAlignment[] | undefined;
|
package/dist/codec.cjs
CHANGED
|
@@ -13,7 +13,7 @@ function isWellFormedUtf8Text(bytes) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
const MarkdownBytesSchema = zod.z.instanceof(Uint8Array).refine(isWellFormedUtf8Text, { message: "not well-formed UTF-8 text" });
|
|
16
|
-
const markdownCodec = zod.z.codec(MarkdownBytesSchema, document_schema_js.
|
|
16
|
+
const markdownCodec = zod.z.codec(MarkdownBytesSchema, document_schema_js.DocumentTreeSchema, {
|
|
17
17
|
decode: (bytes) => require_read.readMarkdown(new TextDecoder().decode(bytes)).documentPackage,
|
|
18
18
|
encode: (documentPackage) => new TextEncoder().encode(require_write.writeMarkdown(documentPackage))
|
|
19
19
|
});
|
package/dist/codec.d.cts
CHANGED
|
@@ -86,9 +86,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
86
86
|
symbol: z.ZodString;
|
|
87
87
|
name: z.ZodOptional<z.ZodString>;
|
|
88
88
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
89
|
+
time: "time";
|
|
89
90
|
length: "length";
|
|
90
91
|
mass: "mass";
|
|
91
|
-
time: "time";
|
|
92
92
|
electricCurrent: "electricCurrent";
|
|
93
93
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
94
94
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -212,9 +212,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
212
212
|
symbol: z.ZodString;
|
|
213
213
|
name: z.ZodOptional<z.ZodString>;
|
|
214
214
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
215
|
+
time: "time";
|
|
215
216
|
length: "length";
|
|
216
217
|
mass: "mass";
|
|
217
|
-
time: "time";
|
|
218
218
|
electricCurrent: "electricCurrent";
|
|
219
219
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
220
220
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -338,9 +338,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
338
338
|
symbol: z.ZodString;
|
|
339
339
|
name: z.ZodOptional<z.ZodString>;
|
|
340
340
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
341
|
+
time: "time";
|
|
341
342
|
length: "length";
|
|
342
343
|
mass: "mass";
|
|
343
|
-
time: "time";
|
|
344
344
|
electricCurrent: "electricCurrent";
|
|
345
345
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
346
346
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -464,9 +464,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
464
464
|
symbol: z.ZodString;
|
|
465
465
|
name: z.ZodOptional<z.ZodString>;
|
|
466
466
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
467
|
+
time: "time";
|
|
467
468
|
length: "length";
|
|
468
469
|
mass: "mass";
|
|
469
|
-
time: "time";
|
|
470
470
|
electricCurrent: "electricCurrent";
|
|
471
471
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
472
472
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -619,9 +619,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
619
619
|
symbol: z.ZodString;
|
|
620
620
|
name: z.ZodOptional<z.ZodString>;
|
|
621
621
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
622
|
+
time: "time";
|
|
622
623
|
length: "length";
|
|
623
624
|
mass: "mass";
|
|
624
|
-
time: "time";
|
|
625
625
|
electricCurrent: "electricCurrent";
|
|
626
626
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
627
627
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -712,9 +712,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
712
712
|
symbol: z.ZodString;
|
|
713
713
|
name: z.ZodOptional<z.ZodString>;
|
|
714
714
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
715
|
+
time: "time";
|
|
715
716
|
length: "length";
|
|
716
717
|
mass: "mass";
|
|
717
|
-
time: "time";
|
|
718
718
|
electricCurrent: "electricCurrent";
|
|
719
719
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
720
720
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -835,9 +835,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
835
835
|
symbol: z.ZodString;
|
|
836
836
|
name: z.ZodOptional<z.ZodString>;
|
|
837
837
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
838
|
+
time: "time";
|
|
838
839
|
length: "length";
|
|
839
840
|
mass: "mass";
|
|
840
|
-
time: "time";
|
|
841
841
|
electricCurrent: "electricCurrent";
|
|
842
842
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
843
843
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1193,9 +1193,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1193
1193
|
symbol: z.ZodString;
|
|
1194
1194
|
name: z.ZodOptional<z.ZodString>;
|
|
1195
1195
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
1196
|
+
time: "time";
|
|
1196
1197
|
length: "length";
|
|
1197
1198
|
mass: "mass";
|
|
1198
|
-
time: "time";
|
|
1199
1199
|
electricCurrent: "electricCurrent";
|
|
1200
1200
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
1201
1201
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1560,9 +1560,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1560
1560
|
symbol: z.ZodString;
|
|
1561
1561
|
name: z.ZodOptional<z.ZodString>;
|
|
1562
1562
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
1563
|
+
time: "time";
|
|
1563
1564
|
length: "length";
|
|
1564
1565
|
mass: "mass";
|
|
1565
|
-
time: "time";
|
|
1566
1566
|
electricCurrent: "electricCurrent";
|
|
1567
1567
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
1568
1568
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1646,9 +1646,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1646
1646
|
symbol: z.ZodString;
|
|
1647
1647
|
name: z.ZodOptional<z.ZodString>;
|
|
1648
1648
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
1649
|
+
time: "time";
|
|
1649
1650
|
length: "length";
|
|
1650
1651
|
mass: "mass";
|
|
1651
|
-
time: "time";
|
|
1652
1652
|
electricCurrent: "electricCurrent";
|
|
1653
1653
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
1654
1654
|
amountOfSubstance: "amountOfSubstance";
|
package/dist/codec.d.ts
CHANGED
|
@@ -86,9 +86,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
86
86
|
symbol: z.ZodString;
|
|
87
87
|
name: z.ZodOptional<z.ZodString>;
|
|
88
88
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
89
|
+
time: "time";
|
|
89
90
|
length: "length";
|
|
90
91
|
mass: "mass";
|
|
91
|
-
time: "time";
|
|
92
92
|
electricCurrent: "electricCurrent";
|
|
93
93
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
94
94
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -212,9 +212,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
212
212
|
symbol: z.ZodString;
|
|
213
213
|
name: z.ZodOptional<z.ZodString>;
|
|
214
214
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
215
|
+
time: "time";
|
|
215
216
|
length: "length";
|
|
216
217
|
mass: "mass";
|
|
217
|
-
time: "time";
|
|
218
218
|
electricCurrent: "electricCurrent";
|
|
219
219
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
220
220
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -338,9 +338,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
338
338
|
symbol: z.ZodString;
|
|
339
339
|
name: z.ZodOptional<z.ZodString>;
|
|
340
340
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
341
|
+
time: "time";
|
|
341
342
|
length: "length";
|
|
342
343
|
mass: "mass";
|
|
343
|
-
time: "time";
|
|
344
344
|
electricCurrent: "electricCurrent";
|
|
345
345
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
346
346
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -464,9 +464,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
464
464
|
symbol: z.ZodString;
|
|
465
465
|
name: z.ZodOptional<z.ZodString>;
|
|
466
466
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
467
|
+
time: "time";
|
|
467
468
|
length: "length";
|
|
468
469
|
mass: "mass";
|
|
469
|
-
time: "time";
|
|
470
470
|
electricCurrent: "electricCurrent";
|
|
471
471
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
472
472
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -619,9 +619,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
619
619
|
symbol: z.ZodString;
|
|
620
620
|
name: z.ZodOptional<z.ZodString>;
|
|
621
621
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
622
|
+
time: "time";
|
|
622
623
|
length: "length";
|
|
623
624
|
mass: "mass";
|
|
624
|
-
time: "time";
|
|
625
625
|
electricCurrent: "electricCurrent";
|
|
626
626
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
627
627
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -712,9 +712,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
712
712
|
symbol: z.ZodString;
|
|
713
713
|
name: z.ZodOptional<z.ZodString>;
|
|
714
714
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
715
|
+
time: "time";
|
|
715
716
|
length: "length";
|
|
716
717
|
mass: "mass";
|
|
717
|
-
time: "time";
|
|
718
718
|
electricCurrent: "electricCurrent";
|
|
719
719
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
720
720
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -835,9 +835,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
835
835
|
symbol: z.ZodString;
|
|
836
836
|
name: z.ZodOptional<z.ZodString>;
|
|
837
837
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
838
|
+
time: "time";
|
|
838
839
|
length: "length";
|
|
839
840
|
mass: "mass";
|
|
840
|
-
time: "time";
|
|
841
841
|
electricCurrent: "electricCurrent";
|
|
842
842
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
843
843
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1193,9 +1193,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1193
1193
|
symbol: z.ZodString;
|
|
1194
1194
|
name: z.ZodOptional<z.ZodString>;
|
|
1195
1195
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
1196
|
+
time: "time";
|
|
1196
1197
|
length: "length";
|
|
1197
1198
|
mass: "mass";
|
|
1198
|
-
time: "time";
|
|
1199
1199
|
electricCurrent: "electricCurrent";
|
|
1200
1200
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
1201
1201
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1560,9 +1560,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1560
1560
|
symbol: z.ZodString;
|
|
1561
1561
|
name: z.ZodOptional<z.ZodString>;
|
|
1562
1562
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
1563
|
+
time: "time";
|
|
1563
1564
|
length: "length";
|
|
1564
1565
|
mass: "mass";
|
|
1565
|
-
time: "time";
|
|
1566
1566
|
electricCurrent: "electricCurrent";
|
|
1567
1567
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
1568
1568
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1646,9 +1646,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1646
1646
|
symbol: z.ZodString;
|
|
1647
1647
|
name: z.ZodOptional<z.ZodString>;
|
|
1648
1648
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
1649
|
+
time: "time";
|
|
1649
1650
|
length: "length";
|
|
1650
1651
|
mass: "mass";
|
|
1651
|
-
time: "time";
|
|
1652
1652
|
electricCurrent: "electricCurrent";
|
|
1653
1653
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
1654
1654
|
amountOfSubstance: "amountOfSubstance";
|
package/dist/codec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readMarkdown, readMarkdownContent } from "./read.js";
|
|
2
2
|
import { writeMarkdown, writeMarkdownContent } from "./write.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { ContentDocumentSchema,
|
|
4
|
+
import { ContentDocumentSchema, DocumentTreeSchema } from "document-schema.js";
|
|
5
5
|
//#region src/codec.ts
|
|
6
6
|
function isWellFormedUtf8Text(bytes) {
|
|
7
7
|
try {
|
|
@@ -12,7 +12,7 @@ function isWellFormedUtf8Text(bytes) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
const MarkdownBytesSchema = z.instanceof(Uint8Array).refine(isWellFormedUtf8Text, { message: "not well-formed UTF-8 text" });
|
|
15
|
-
const markdownCodec = z.codec(MarkdownBytesSchema,
|
|
15
|
+
const markdownCodec = z.codec(MarkdownBytesSchema, DocumentTreeSchema, {
|
|
16
16
|
decode: (bytes) => readMarkdown(new TextDecoder().decode(bytes)).documentPackage,
|
|
17
17
|
encode: (documentPackage) => new TextEncoder().encode(writeMarkdown(documentPackage))
|
|
18
18
|
});
|
|
@@ -3,7 +3,7 @@ import { Margins } from "document-schema.js";
|
|
|
3
3
|
//#region src/defaults/defaults.d.ts
|
|
4
4
|
declare const DEFAULT_MARGINS: Margins;
|
|
5
5
|
declare const DEFAULT_MAX_BLOCK_NESTING = 250;
|
|
6
|
-
declare const DEFAULT_RAW_HTML_MODE:
|
|
6
|
+
declare const DEFAULT_RAW_HTML_MODE: "preserve" | "drop";
|
|
7
7
|
declare const DEFAULT_FRONT_MATTER = false;
|
|
8
8
|
declare const DEFAULT_HEADING_STYLE: MarkdownHeadingStyle;
|
|
9
9
|
declare const DEFAULT_BULLET_LIST_MARKER: MarkdownBulletListMarker;
|
|
@@ -3,7 +3,7 @@ import { Margins } from "document-schema.js";
|
|
|
3
3
|
//#region src/defaults/defaults.d.ts
|
|
4
4
|
declare const DEFAULT_MARGINS: Margins;
|
|
5
5
|
declare const DEFAULT_MAX_BLOCK_NESTING = 250;
|
|
6
|
-
declare const DEFAULT_RAW_HTML_MODE:
|
|
6
|
+
declare const DEFAULT_RAW_HTML_MODE: "preserve" | "drop";
|
|
7
7
|
declare const DEFAULT_FRONT_MATTER = false;
|
|
8
8
|
declare const DEFAULT_HEADING_STYLE: MarkdownHeadingStyle;
|
|
9
9
|
declare const DEFAULT_BULLET_LIST_MARKER: MarkdownBulletListMarker;
|
|
@@ -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-
|
|
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-CH-xa2-s.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-
|
|
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-CH-xa2-s.js";
|
|
2
2
|
export { MarkdownDiagnostic, MarkdownDiagnosticCodes, MarkdownDiagnosticSeverity, MarkdownDiagnosticSink, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownPackageFlattenError, MarkdownParseError, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/diagnostics/diagnostics.d.ts
|
|
2
|
-
type MarkdownDiagnosticSeverity =
|
|
2
|
+
type MarkdownDiagnosticSeverity = "info" | "warning";
|
|
3
3
|
interface MarkdownDiagnostic {
|
|
4
4
|
readonly code: string;
|
|
5
5
|
readonly severity: MarkdownDiagnosticSeverity;
|
|
@@ -58,14 +58,14 @@ declare class MarkdownWriteError extends Error {
|
|
|
58
58
|
constructor(code: string, message: string);
|
|
59
59
|
}
|
|
60
60
|
declare class MarkdownUnbalancedConstructMarkersError extends MarkdownWriteError {
|
|
61
|
-
readonly imbalanceKind:
|
|
61
|
+
readonly imbalanceKind: "unmatchedEnd" | "unclosedStart";
|
|
62
62
|
readonly blockIndex: number;
|
|
63
|
-
constructor(imbalanceKind:
|
|
63
|
+
constructor(imbalanceKind: "unmatchedEnd" | "unclosedStart", blockIndex: number);
|
|
64
64
|
}
|
|
65
65
|
declare class MarkdownInvalidRunConstructExtentError extends MarkdownWriteError {
|
|
66
|
-
readonly faultKind:
|
|
66
|
+
readonly faultKind: "invertedRange" | "beyondRuns";
|
|
67
67
|
readonly entryIndex: number;
|
|
68
|
-
constructor(faultKind:
|
|
68
|
+
constructor(faultKind: "invertedRange" | "beyondRuns", entryIndex: number);
|
|
69
69
|
}
|
|
70
70
|
declare class MarkdownUnsupportedDocumentKindError extends MarkdownWriteError {
|
|
71
71
|
readonly kind: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/diagnostics/diagnostics.d.ts
|
|
2
|
-
type MarkdownDiagnosticSeverity =
|
|
2
|
+
type MarkdownDiagnosticSeverity = "info" | "warning";
|
|
3
3
|
interface MarkdownDiagnostic {
|
|
4
4
|
readonly code: string;
|
|
5
5
|
readonly severity: MarkdownDiagnosticSeverity;
|
|
@@ -58,14 +58,14 @@ declare class MarkdownWriteError extends Error {
|
|
|
58
58
|
constructor(code: string, message: string);
|
|
59
59
|
}
|
|
60
60
|
declare class MarkdownUnbalancedConstructMarkersError extends MarkdownWriteError {
|
|
61
|
-
readonly imbalanceKind:
|
|
61
|
+
readonly imbalanceKind: "unmatchedEnd" | "unclosedStart";
|
|
62
62
|
readonly blockIndex: number;
|
|
63
|
-
constructor(imbalanceKind:
|
|
63
|
+
constructor(imbalanceKind: "unmatchedEnd" | "unclosedStart", blockIndex: number);
|
|
64
64
|
}
|
|
65
65
|
declare class MarkdownInvalidRunConstructExtentError extends MarkdownWriteError {
|
|
66
|
-
readonly faultKind:
|
|
66
|
+
readonly faultKind: "invertedRange" | "beyondRuns";
|
|
67
67
|
readonly entryIndex: number;
|
|
68
|
-
constructor(faultKind:
|
|
68
|
+
constructor(faultKind: "invertedRange" | "beyondRuns", entryIndex: number);
|
|
69
69
|
}
|
|
70
70
|
declare class MarkdownUnsupportedDocumentKindError extends MarkdownWriteError {
|
|
71
71
|
readonly kind: string;
|
package/dist/emit/emit.cjs
CHANGED
|
@@ -192,7 +192,7 @@ function renderListRegion(items, context) {
|
|
|
192
192
|
let ownEnd = index + 1;
|
|
193
193
|
if (itemId !== void 0) while (ownEnd < items.length) {
|
|
194
194
|
const candidate = items[ownEnd];
|
|
195
|
-
if (candidate?.list?.level !== level || candidate.list
|
|
195
|
+
if (candidate?.list?.level !== level || candidate.list.itemId !== itemId) break;
|
|
196
196
|
ownEnd += 1;
|
|
197
197
|
}
|
|
198
198
|
const ownBlocks = items.slice(index, ownEnd);
|
package/dist/emit/emit.js
CHANGED
|
@@ -191,7 +191,7 @@ function renderListRegion(items, context) {
|
|
|
191
191
|
let ownEnd = index + 1;
|
|
192
192
|
if (itemId !== void 0) while (ownEnd < items.length) {
|
|
193
193
|
const candidate = items[ownEnd];
|
|
194
|
-
if (candidate?.list?.level !== level || candidate.list
|
|
194
|
+
if (candidate?.list?.level !== level || candidate.list.itemId !== itemId) break;
|
|
195
195
|
ownEnd += 1;
|
|
196
196
|
}
|
|
197
197
|
const ownBlocks = items.slice(index, ownEnd);
|
package/dist/emit/inline.cjs
CHANGED
|
@@ -158,7 +158,7 @@ function linkTitleCovering(constructs, start, end) {
|
|
|
158
158
|
}
|
|
159
159
|
return tightest?.descriptor.kind === "link" ? tightest.descriptor.title : void 0;
|
|
160
160
|
}
|
|
161
|
-
function emitRuns(runs, context, constructs
|
|
161
|
+
function emitRuns(runs, context, constructs) {
|
|
162
162
|
let out = "";
|
|
163
163
|
let index = 0;
|
|
164
164
|
while (index < runs.length) {
|
|
@@ -190,7 +190,7 @@ function emitRuns(runs, context, constructs = void 0) {
|
|
|
190
190
|
}
|
|
191
191
|
return out;
|
|
192
192
|
}
|
|
193
|
-
function emitRunsSingleLine(runs, context, constructs
|
|
193
|
+
function emitRunsSingleLine(runs, context, constructs) {
|
|
194
194
|
return emitRuns(runs, context, constructs).replace(/\\\n/g, " ");
|
|
195
195
|
}
|
|
196
196
|
//#endregion
|
package/dist/emit/inline.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CH-xa2-s.cjs";
|
|
2
2
|
import { ContentRun, RunConstructExtent } from "document-schema.js";
|
|
3
3
|
//#region src/emit/inline.d.ts
|
|
4
4
|
interface InlineEmitContext {
|
|
@@ -8,7 +8,7 @@ interface InlineEmitContext {
|
|
|
8
8
|
declare function escapeMarkdownText(text: string): string;
|
|
9
9
|
declare function escapeLinkDestination(destination: string): string;
|
|
10
10
|
declare function renderLinkTitle(title: string): string;
|
|
11
|
-
declare function emitRuns(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[]
|
|
12
|
-
declare function emitRunsSingleLine(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[]
|
|
11
|
+
declare function emitRuns(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[]): string;
|
|
12
|
+
declare function emitRunsSingleLine(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[]): string;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { InlineEmitContext, emitRuns, emitRunsSingleLine, escapeLinkDestination, escapeMarkdownText, renderLinkTitle };
|
package/dist/emit/inline.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CH-xa2-s.js";
|
|
2
2
|
import { ContentRun, RunConstructExtent } from "document-schema.js";
|
|
3
3
|
//#region src/emit/inline.d.ts
|
|
4
4
|
interface InlineEmitContext {
|
|
@@ -8,7 +8,7 @@ interface InlineEmitContext {
|
|
|
8
8
|
declare function escapeMarkdownText(text: string): string;
|
|
9
9
|
declare function escapeLinkDestination(destination: string): string;
|
|
10
10
|
declare function renderLinkTitle(title: string): string;
|
|
11
|
-
declare function emitRuns(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[]
|
|
12
|
-
declare function emitRunsSingleLine(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[]
|
|
11
|
+
declare function emitRuns(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[]): string;
|
|
12
|
+
declare function emitRunsSingleLine(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[]): string;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { InlineEmitContext, emitRuns, emitRunsSingleLine, escapeLinkDestination, escapeMarkdownText, renderLinkTitle };
|
package/dist/emit/inline.js
CHANGED
|
@@ -157,7 +157,7 @@ function linkTitleCovering(constructs, start, end) {
|
|
|
157
157
|
}
|
|
158
158
|
return tightest?.descriptor.kind === "link" ? tightest.descriptor.title : void 0;
|
|
159
159
|
}
|
|
160
|
-
function emitRuns(runs, context, constructs
|
|
160
|
+
function emitRuns(runs, context, constructs) {
|
|
161
161
|
let out = "";
|
|
162
162
|
let index = 0;
|
|
163
163
|
while (index < runs.length) {
|
|
@@ -189,7 +189,7 @@ function emitRuns(runs, context, constructs = void 0) {
|
|
|
189
189
|
}
|
|
190
190
|
return out;
|
|
191
191
|
}
|
|
192
|
-
function emitRunsSingleLine(runs, context, constructs
|
|
192
|
+
function emitRunsSingleLine(runs, context, constructs) {
|
|
193
193
|
return emitRuns(runs, context, constructs).replace(/\\\n/g, " ");
|
|
194
194
|
}
|
|
195
195
|
//#endregion
|
package/dist/emit/table.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CH-xa2-s.cjs";
|
|
2
2
|
import { InlineEmitContext } from "./inline.cjs";
|
|
3
3
|
import { ContentTable } from "document-schema.js";
|
|
4
4
|
//#region src/emit/table.d.ts
|
package/dist/emit/table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CH-xa2-s.js";
|
|
2
2
|
import { InlineEmitContext } from "./inline.js";
|
|
3
3
|
import { ContentTable } from "document-schema.js";
|
|
4
4
|
//#region src/emit/table.d.ts
|
package/dist/html/render.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as MarkdownDocumentNode, v as MarkdownInlineNode } from "../ast-
|
|
1
|
+
import { s as MarkdownDocumentNode, v as MarkdownInlineNode } from "../ast-CNfTgS0N.cjs";
|
|
2
2
|
//#region src/html/render.d.ts
|
|
3
3
|
declare function escapeHtml(text: string): string;
|
|
4
4
|
declare function escapeHref(href: string): string;
|
package/dist/html/render.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as MarkdownDocumentNode, v as MarkdownInlineNode } from "../ast-
|
|
1
|
+
import { s as MarkdownDocumentNode, v as MarkdownInlineNode } from "../ast-CNfTgS0N.js";
|
|
2
2
|
//#region src/html/render.d.ts
|
|
3
3
|
declare function escapeHtml(text: string): string;
|
|
4
4
|
declare function escapeHref(href: string): string;
|
package/dist/image/image.cjs
CHANGED
|
@@ -14,10 +14,10 @@ function bytesToBase64(bytes) {
|
|
|
14
14
|
const b0 = bytes[index];
|
|
15
15
|
const b1 = index + 1 < length ? bytes[index + 1] : 0;
|
|
16
16
|
const b2 = index + 2 < length ? bytes[index + 2] : 0;
|
|
17
|
-
out += BASE64_TABLE
|
|
18
|
-
out += BASE64_TABLE
|
|
19
|
-
out += index + 1 < length ? BASE64_TABLE
|
|
20
|
-
out += index + 2 < length ? BASE64_TABLE
|
|
17
|
+
out += BASE64_TABLE.charAt(b0 >> 2);
|
|
18
|
+
out += BASE64_TABLE.charAt((b0 & 3) << 4 | b1 >> 4);
|
|
19
|
+
out += index + 1 < length ? BASE64_TABLE.charAt((b1 & 15) << 2 | b2 >> 6) : "=";
|
|
20
|
+
out += index + 2 < length ? BASE64_TABLE.charAt(b2 & 63) : "=";
|
|
21
21
|
}
|
|
22
22
|
return out;
|
|
23
23
|
}
|
package/dist/image/image.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as detectImageFormat, i as bytesToBase64, n as ImageFormat, o as readImageDimensions, r as base64ToBytes, t as ImageDimensions } from "../image-
|
|
1
|
+
import { a as detectImageFormat, i as bytesToBase64, n as ImageFormat, o as readImageDimensions, r as base64ToBytes, t as ImageDimensions } from "../image-BtmTG4_a.cjs";
|
|
2
2
|
export { ImageDimensions, ImageFormat, base64ToBytes, bytesToBase64, detectImageFormat, readImageDimensions };
|
package/dist/image/image.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as detectImageFormat, i as bytesToBase64, n as ImageFormat, o as readImageDimensions, r as base64ToBytes, t as ImageDimensions } from "../image-
|
|
1
|
+
import { a as detectImageFormat, i as bytesToBase64, n as ImageFormat, o as readImageDimensions, r as base64ToBytes, t as ImageDimensions } from "../image-BtmTG4_a.js";
|
|
2
2
|
export { ImageDimensions, ImageFormat, base64ToBytes, bytesToBase64, detectImageFormat, readImageDimensions };
|
package/dist/image/image.js
CHANGED
|
@@ -13,10 +13,10 @@ function bytesToBase64(bytes) {
|
|
|
13
13
|
const b0 = bytes[index];
|
|
14
14
|
const b1 = index + 1 < length ? bytes[index + 1] : 0;
|
|
15
15
|
const b2 = index + 2 < length ? bytes[index + 2] : 0;
|
|
16
|
-
out += BASE64_TABLE
|
|
17
|
-
out += BASE64_TABLE
|
|
18
|
-
out += index + 1 < length ? BASE64_TABLE
|
|
19
|
-
out += index + 2 < length ? BASE64_TABLE
|
|
16
|
+
out += BASE64_TABLE.charAt(b0 >> 2);
|
|
17
|
+
out += BASE64_TABLE.charAt((b0 & 3) << 4 | b1 >> 4);
|
|
18
|
+
out += index + 1 < length ? BASE64_TABLE.charAt((b1 & 15) << 2 | b2 >> 6) : "=";
|
|
19
|
+
out += index + 2 < length ? BASE64_TABLE.charAt(b2 & 63) : "=";
|
|
20
20
|
}
|
|
21
21
|
return out;
|
|
22
22
|
}
|
|
@@ -3,7 +3,7 @@ interface ImageDimensions {
|
|
|
3
3
|
readonly widthPx: number;
|
|
4
4
|
readonly heightPx: number;
|
|
5
5
|
}
|
|
6
|
-
type ImageFormat =
|
|
6
|
+
type ImageFormat = "png" | "jpeg";
|
|
7
7
|
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
8
8
|
declare function base64ToBytes(base64: string): Uint8Array;
|
|
9
9
|
declare function detectImageFormat(bytes: Uint8Array): ImageFormat | undefined;
|
|
@@ -3,7 +3,7 @@ interface ImageDimensions {
|
|
|
3
3
|
readonly widthPx: number;
|
|
4
4
|
readonly heightPx: number;
|
|
5
5
|
}
|
|
6
|
-
type ImageFormat =
|
|
6
|
+
type ImageFormat = "png" | "jpeg";
|
|
7
7
|
declare function bytesToBase64(bytes: Uint8Array): string;
|
|
8
8
|
declare function base64ToBytes(base64: string): Uint8Array;
|
|
9
9
|
declare function detectImageFormat(bytes: Uint8Array): ImageFormat | undefined;
|