markdown-codec 11.1.6 → 11.1.8
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.cjs +7 -0
- package/dist/block/block.d.cts +3 -2
- package/dist/block/block.d.ts +3 -2
- package/dist/block/block.js +7 -1
- package/dist/emit/emit.cjs +7 -2
- package/dist/emit/emit.d.cts +2 -1
- package/dist/emit/emit.d.ts +2 -1
- package/dist/emit/emit.js +7 -3
- package/dist/emit/table.cjs +5 -0
- package/dist/emit/table.d.cts +2 -1
- package/dist/emit/table.d.ts +2 -1
- package/dist/emit/table.js +5 -1
- package/dist/html/render.cjs +5 -0
- package/dist/html/render.d.cts +2 -1
- package/dist/html/render.d.ts +2 -1
- package/dist/html/render.js +5 -1
- package/dist/inline/inline.cjs +5 -0
- package/dist/inline/inline.d.cts +2 -2
- package/dist/inline/inline.d.ts +2 -2
- package/dist/inline/inline.js +5 -1
- package/dist/{inline-CnO86zMw.d.cts → inline-B8WNyxnI.d.cts} +2 -1
- package/dist/{inline-DItZ-VVw.d.ts → inline-BBtsaDjb.d.ts} +2 -1
- package/dist/lower/lower.cjs +5 -0
- package/dist/lower/lower.d.cts +2 -1
- package/dist/lower/lower.d.ts +2 -1
- package/dist/lower/lower.js +5 -1
- package/package.json +2 -2
package/dist/block/block.cjs
CHANGED
|
@@ -138,6 +138,7 @@ var BlockParser = class {
|
|
|
138
138
|
case "heading":
|
|
139
139
|
case "thematicBreak": return "not-matched";
|
|
140
140
|
}
|
|
141
|
+
return assertNeverBlockKind(node.kind);
|
|
141
142
|
}
|
|
142
143
|
continueBlockquote() {
|
|
143
144
|
if (!this.consumeBlockquoteMarker()) return "not-matched";
|
|
@@ -437,6 +438,7 @@ var BlockParser = class {
|
|
|
437
438
|
case "list":
|
|
438
439
|
require_block_list.finalizeListTightness(node);
|
|
439
440
|
return;
|
|
441
|
+
default: return;
|
|
440
442
|
}
|
|
441
443
|
}
|
|
442
444
|
finalizeCodeBlock(node) {
|
|
@@ -577,6 +579,7 @@ function toAstBlock(node, context) {
|
|
|
577
579
|
case "document":
|
|
578
580
|
case "listItem": return;
|
|
579
581
|
}
|
|
582
|
+
return assertNeverBlockKind(node.kind);
|
|
580
583
|
}
|
|
581
584
|
function toAstBlocks(nodes, context) {
|
|
582
585
|
const blocks = [];
|
|
@@ -603,9 +606,13 @@ function parseMarkdown(source, options = {}) {
|
|
|
603
606
|
footnotes: context.footnotes
|
|
604
607
|
};
|
|
605
608
|
}
|
|
609
|
+
function assertNeverBlockKind(kind) {
|
|
610
|
+
throw new Error(`markdown-codec: unhandled block kind ${JSON.stringify(kind)}`);
|
|
611
|
+
}
|
|
606
612
|
//#endregion
|
|
607
613
|
exports.ATX_MARKER_PATTERN = ATX_MARKER_PATTERN;
|
|
608
614
|
exports.CODE_FENCE_PATTERN = CODE_FENCE_PATTERN;
|
|
609
615
|
exports.MATH_BLOCK_MARKER_PATTERN = MATH_BLOCK_MARKER_PATTERN;
|
|
610
616
|
exports.THEMATIC_BREAK_PATTERN = THEMATIC_BREAK_PATTERN;
|
|
617
|
+
exports.assertNeverBlockKind = assertNeverBlockKind;
|
|
611
618
|
exports.parseMarkdown = parseMarkdown;
|
package/dist/block/block.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { s as MarkdownDocumentNode } from "../ast-CNfTgS0N.cjs";
|
|
|
2
2
|
import { r as FootnoteLabelSet } from "../footnote-CKk4JbLk.cjs";
|
|
3
3
|
import { i as MarkdownDiagnosticSink } from "../diagnostics-D3UiC9HL.cjs";
|
|
4
4
|
import { LinkReferenceMap } from "../inline/link.cjs";
|
|
5
|
-
import { t as InlineParseOptions } from "../inline-
|
|
5
|
+
import { t as InlineParseOptions } from "../inline-B8WNyxnI.cjs";
|
|
6
6
|
//#region src/block/block.d.ts
|
|
7
7
|
declare const ATX_MARKER_PATTERN: RegExp;
|
|
8
8
|
declare const CODE_FENCE_PATTERN: RegExp;
|
|
@@ -21,5 +21,6 @@ interface ParsedMarkdown {
|
|
|
21
21
|
readonly footnotes: FootnoteLabelSet;
|
|
22
22
|
}
|
|
23
23
|
declare function parseMarkdown(source: string, options?: MarkdownParseOptions): ParsedMarkdown;
|
|
24
|
+
declare function assertNeverBlockKind(kind: never): never;
|
|
24
25
|
//#endregion
|
|
25
|
-
export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, MarkdownParseOptions, ParsedMarkdown, THEMATIC_BREAK_PATTERN, parseMarkdown };
|
|
26
|
+
export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, MarkdownParseOptions, ParsedMarkdown, THEMATIC_BREAK_PATTERN, assertNeverBlockKind, parseMarkdown };
|
package/dist/block/block.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { s as MarkdownDocumentNode } from "../ast-CNfTgS0N.js";
|
|
|
2
2
|
import { r as FootnoteLabelSet } from "../footnote-CKk4JbLk.js";
|
|
3
3
|
import { i as MarkdownDiagnosticSink } from "../diagnostics-D3UiC9HL.js";
|
|
4
4
|
import { LinkReferenceMap } from "../inline/link.js";
|
|
5
|
-
import { t as InlineParseOptions } from "../inline-
|
|
5
|
+
import { t as InlineParseOptions } from "../inline-BBtsaDjb.js";
|
|
6
6
|
//#region src/block/block.d.ts
|
|
7
7
|
declare const ATX_MARKER_PATTERN: RegExp;
|
|
8
8
|
declare const CODE_FENCE_PATTERN: RegExp;
|
|
@@ -21,5 +21,6 @@ interface ParsedMarkdown {
|
|
|
21
21
|
readonly footnotes: FootnoteLabelSet;
|
|
22
22
|
}
|
|
23
23
|
declare function parseMarkdown(source: string, options?: MarkdownParseOptions): ParsedMarkdown;
|
|
24
|
+
declare function assertNeverBlockKind(kind: never): never;
|
|
24
25
|
//#endregion
|
|
25
|
-
export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, MarkdownParseOptions, ParsedMarkdown, THEMATIC_BREAK_PATTERN, parseMarkdown };
|
|
26
|
+
export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, MarkdownParseOptions, ParsedMarkdown, THEMATIC_BREAK_PATTERN, assertNeverBlockKind, parseMarkdown };
|
package/dist/block/block.js
CHANGED
|
@@ -137,6 +137,7 @@ var BlockParser = class {
|
|
|
137
137
|
case "heading":
|
|
138
138
|
case "thematicBreak": return "not-matched";
|
|
139
139
|
}
|
|
140
|
+
return assertNeverBlockKind(node.kind);
|
|
140
141
|
}
|
|
141
142
|
continueBlockquote() {
|
|
142
143
|
if (!this.consumeBlockquoteMarker()) return "not-matched";
|
|
@@ -436,6 +437,7 @@ var BlockParser = class {
|
|
|
436
437
|
case "list":
|
|
437
438
|
finalizeListTightness(node);
|
|
438
439
|
return;
|
|
440
|
+
default: return;
|
|
439
441
|
}
|
|
440
442
|
}
|
|
441
443
|
finalizeCodeBlock(node) {
|
|
@@ -576,6 +578,7 @@ function toAstBlock(node, context) {
|
|
|
576
578
|
case "document":
|
|
577
579
|
case "listItem": return;
|
|
578
580
|
}
|
|
581
|
+
return assertNeverBlockKind(node.kind);
|
|
579
582
|
}
|
|
580
583
|
function toAstBlocks(nodes, context) {
|
|
581
584
|
const blocks = [];
|
|
@@ -602,5 +605,8 @@ function parseMarkdown(source, options = {}) {
|
|
|
602
605
|
footnotes: context.footnotes
|
|
603
606
|
};
|
|
604
607
|
}
|
|
608
|
+
function assertNeverBlockKind(kind) {
|
|
609
|
+
throw new Error(`markdown-codec: unhandled block kind ${JSON.stringify(kind)}`);
|
|
610
|
+
}
|
|
605
611
|
//#endregion
|
|
606
|
-
export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, THEMATIC_BREAK_PATTERN, parseMarkdown };
|
|
612
|
+
export { ATX_MARKER_PATTERN, CODE_FENCE_PATTERN, MATH_BLOCK_MARKER_PATTERN, THEMATIC_BREAK_PATTERN, assertNeverBlockKind, parseMarkdown };
|
package/dist/emit/emit.cjs
CHANGED
|
@@ -219,6 +219,7 @@ function renderTopLevelBlock(block, context) {
|
|
|
219
219
|
return "";
|
|
220
220
|
case "pageBreak": return "";
|
|
221
221
|
}
|
|
222
|
+
return assertNeverRenderableBlock(block);
|
|
222
223
|
}
|
|
223
224
|
function listInfoFor(numId, context) {
|
|
224
225
|
if (numId === void 0) {
|
|
@@ -245,8 +246,8 @@ function listInfoFor(numId, context) {
|
|
|
245
246
|
}
|
|
246
247
|
function stripCheckboxRun(item) {
|
|
247
248
|
const first = item.runs[0];
|
|
248
|
-
const glyphPrefix = first?.text.startsWith(`☒ `) ? `☒ ` : `☐ `;
|
|
249
|
-
if (
|
|
249
|
+
const glyphPrefix = first?.text.startsWith(`☒ `) === true ? `☒ ` : `☐ `;
|
|
250
|
+
if (first?.text.startsWith(glyphPrefix) !== true) return item;
|
|
250
251
|
const strippedText = first.text.slice(glyphPrefix.length);
|
|
251
252
|
const runs = strippedText.length === 0 ? item.runs.slice(1) : [{
|
|
252
253
|
...first,
|
|
@@ -638,5 +639,9 @@ function emitMarkdown(document, options = {}) {
|
|
|
638
639
|
const text = frontMatter === void 0 ? body : `${frontMatter}\n\n${body}`;
|
|
639
640
|
return (options.lineEnding ?? "lf") === "crlf" ? text.replaceAll("\n", "\r\n") : text;
|
|
640
641
|
}
|
|
642
|
+
function assertNeverRenderableBlock(block) {
|
|
643
|
+
throw new Error(`markdown-codec: unhandled renderable block ${JSON.stringify(block)}`);
|
|
644
|
+
}
|
|
641
645
|
//#endregion
|
|
646
|
+
exports.assertNeverRenderableBlock = assertNeverRenderableBlock;
|
|
642
647
|
exports.emitMarkdown = emitMarkdown;
|
package/dist/emit/emit.d.cts
CHANGED
|
@@ -2,5 +2,6 @@ import { WriteMarkdownOptions } from "../options/options.cjs";
|
|
|
2
2
|
import { ContentDocument } from "document-schema.js";
|
|
3
3
|
//#region src/emit/emit.d.ts
|
|
4
4
|
declare function emitMarkdown(document: ContentDocument, options?: WriteMarkdownOptions): string;
|
|
5
|
+
declare function assertNeverRenderableBlock(block: never): never;
|
|
5
6
|
//#endregion
|
|
6
|
-
export { emitMarkdown };
|
|
7
|
+
export { assertNeverRenderableBlock, emitMarkdown };
|
package/dist/emit/emit.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import { WriteMarkdownOptions } from "../options/options.js";
|
|
|
2
2
|
import { ContentDocument } from "document-schema.js";
|
|
3
3
|
//#region src/emit/emit.d.ts
|
|
4
4
|
declare function emitMarkdown(document: ContentDocument, options?: WriteMarkdownOptions): string;
|
|
5
|
+
declare function assertNeverRenderableBlock(block: never): never;
|
|
5
6
|
//#endregion
|
|
6
|
-
export { emitMarkdown };
|
|
7
|
+
export { assertNeverRenderableBlock, emitMarkdown };
|
package/dist/emit/emit.js
CHANGED
|
@@ -218,6 +218,7 @@ function renderTopLevelBlock(block, context) {
|
|
|
218
218
|
return "";
|
|
219
219
|
case "pageBreak": return "";
|
|
220
220
|
}
|
|
221
|
+
return assertNeverRenderableBlock(block);
|
|
221
222
|
}
|
|
222
223
|
function listInfoFor(numId, context) {
|
|
223
224
|
if (numId === void 0) {
|
|
@@ -244,8 +245,8 @@ function listInfoFor(numId, context) {
|
|
|
244
245
|
}
|
|
245
246
|
function stripCheckboxRun(item) {
|
|
246
247
|
const first = item.runs[0];
|
|
247
|
-
const glyphPrefix = first?.text.startsWith(`☒ `) ? `☒ ` : `☐ `;
|
|
248
|
-
if (
|
|
248
|
+
const glyphPrefix = first?.text.startsWith(`☒ `) === true ? `☒ ` : `☐ `;
|
|
249
|
+
if (first?.text.startsWith(glyphPrefix) !== true) return item;
|
|
249
250
|
const strippedText = first.text.slice(glyphPrefix.length);
|
|
250
251
|
const runs = strippedText.length === 0 ? item.runs.slice(1) : [{
|
|
251
252
|
...first,
|
|
@@ -637,5 +638,8 @@ function emitMarkdown(document, options = {}) {
|
|
|
637
638
|
const text = frontMatter === void 0 ? body : `${frontMatter}\n\n${body}`;
|
|
638
639
|
return (options.lineEnding ?? "lf") === "crlf" ? text.replaceAll("\n", "\r\n") : text;
|
|
639
640
|
}
|
|
641
|
+
function assertNeverRenderableBlock(block) {
|
|
642
|
+
throw new Error(`markdown-codec: unhandled renderable block ${JSON.stringify(block)}`);
|
|
643
|
+
}
|
|
640
644
|
//#endregion
|
|
641
|
-
export { emitMarkdown };
|
|
645
|
+
export { assertNeverRenderableBlock, emitMarkdown };
|
package/dist/emit/table.cjs
CHANGED
|
@@ -14,6 +14,7 @@ function delimiterCell(alignment) {
|
|
|
14
14
|
case "center": return ":---:";
|
|
15
15
|
case "none": return "---";
|
|
16
16
|
}
|
|
17
|
+
return assertNeverAlignment(alignment);
|
|
17
18
|
}
|
|
18
19
|
function escapeUnescapedPipes(text) {
|
|
19
20
|
let out = "";
|
|
@@ -91,5 +92,9 @@ function emitTable(table, context) {
|
|
|
91
92
|
...body.map((row) => `| ${row.cells.map((cell) => renderCellText(cell, context)).join(" | ")} |`)
|
|
92
93
|
].join("\n");
|
|
93
94
|
}
|
|
95
|
+
function assertNeverAlignment(alignment) {
|
|
96
|
+
throw new Error(`markdown-codec: unhandled table alignment ${JSON.stringify(alignment)}`);
|
|
97
|
+
}
|
|
94
98
|
//#endregion
|
|
99
|
+
exports.assertNeverAlignment = assertNeverAlignment;
|
|
95
100
|
exports.emitTable = emitTable;
|
package/dist/emit/table.d.cts
CHANGED
|
@@ -7,5 +7,6 @@ interface TableEmitContext extends InlineEmitContext {
|
|
|
7
7
|
readonly embedImages: boolean;
|
|
8
8
|
}
|
|
9
9
|
declare function emitTable(table: ContentTable, context: TableEmitContext): string;
|
|
10
|
+
declare function assertNeverAlignment(alignment: never): never;
|
|
10
11
|
//#endregion
|
|
11
|
-
export { TableEmitContext, emitTable };
|
|
12
|
+
export { TableEmitContext, assertNeverAlignment, emitTable };
|
package/dist/emit/table.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ interface TableEmitContext extends InlineEmitContext {
|
|
|
7
7
|
readonly embedImages: boolean;
|
|
8
8
|
}
|
|
9
9
|
declare function emitTable(table: ContentTable, context: TableEmitContext): string;
|
|
10
|
+
declare function assertNeverAlignment(alignment: never): never;
|
|
10
11
|
//#endregion
|
|
11
|
-
export { TableEmitContext, emitTable };
|
|
12
|
+
export { TableEmitContext, assertNeverAlignment, emitTable };
|
package/dist/emit/table.js
CHANGED
|
@@ -13,6 +13,7 @@ function delimiterCell(alignment) {
|
|
|
13
13
|
case "center": return ":---:";
|
|
14
14
|
case "none": return "---";
|
|
15
15
|
}
|
|
16
|
+
return assertNeverAlignment(alignment);
|
|
16
17
|
}
|
|
17
18
|
function escapeUnescapedPipes(text) {
|
|
18
19
|
let out = "";
|
|
@@ -90,5 +91,8 @@ function emitTable(table, context) {
|
|
|
90
91
|
...body.map((row) => `| ${row.cells.map((cell) => renderCellText(cell, context)).join(" | ")} |`)
|
|
91
92
|
].join("\n");
|
|
92
93
|
}
|
|
94
|
+
function assertNeverAlignment(alignment) {
|
|
95
|
+
throw new Error(`markdown-codec: unhandled table alignment ${JSON.stringify(alignment)}`);
|
|
96
|
+
}
|
|
93
97
|
//#endregion
|
|
94
|
-
export { emitTable };
|
|
98
|
+
export { assertNeverAlignment, emitTable };
|
package/dist/html/render.cjs
CHANGED
|
@@ -82,6 +82,7 @@ function renderInline(node) {
|
|
|
82
82
|
case "footnoteReference": return escapeHtml(`[^${node.label}]`);
|
|
83
83
|
case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
|
|
84
84
|
}
|
|
85
|
+
return assertNeverInlineNode(node);
|
|
85
86
|
}
|
|
86
87
|
function renderInlines(nodes) {
|
|
87
88
|
return nodes.map(renderInline).join("");
|
|
@@ -191,7 +192,11 @@ function renderDocumentToHtml(document) {
|
|
|
191
192
|
renderer.render(document.children, false);
|
|
192
193
|
return renderer.result();
|
|
193
194
|
}
|
|
195
|
+
function assertNeverInlineNode(node) {
|
|
196
|
+
throw new Error(`markdown-codec: unhandled inline node ${JSON.stringify(node)}`);
|
|
197
|
+
}
|
|
194
198
|
//#endregion
|
|
199
|
+
exports.assertNeverInlineNode = assertNeverInlineNode;
|
|
195
200
|
exports.escapeHref = escapeHref;
|
|
196
201
|
exports.escapeHtml = escapeHtml;
|
|
197
202
|
exports.renderDocumentToHtml = renderDocumentToHtml;
|
package/dist/html/render.d.cts
CHANGED
|
@@ -4,5 +4,6 @@ declare function escapeHtml(text: string): string;
|
|
|
4
4
|
declare function escapeHref(href: string): string;
|
|
5
5
|
declare function renderInlines(nodes: readonly MarkdownInlineNode[]): string;
|
|
6
6
|
declare function renderDocumentToHtml(document: MarkdownDocumentNode): string;
|
|
7
|
+
declare function assertNeverInlineNode(node: never): never;
|
|
7
8
|
//#endregion
|
|
8
|
-
export { escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
|
|
9
|
+
export { assertNeverInlineNode, escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
|
package/dist/html/render.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ declare function escapeHtml(text: string): string;
|
|
|
4
4
|
declare function escapeHref(href: string): string;
|
|
5
5
|
declare function renderInlines(nodes: readonly MarkdownInlineNode[]): string;
|
|
6
6
|
declare function renderDocumentToHtml(document: MarkdownDocumentNode): string;
|
|
7
|
+
declare function assertNeverInlineNode(node: never): never;
|
|
7
8
|
//#endregion
|
|
8
|
-
export { escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
|
|
9
|
+
export { assertNeverInlineNode, escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
|
package/dist/html/render.js
CHANGED
|
@@ -81,6 +81,7 @@ function renderInline(node) {
|
|
|
81
81
|
case "footnoteReference": return escapeHtml(`[^${node.label}]`);
|
|
82
82
|
case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
|
|
83
83
|
}
|
|
84
|
+
return assertNeverInlineNode(node);
|
|
84
85
|
}
|
|
85
86
|
function renderInlines(nodes) {
|
|
86
87
|
return nodes.map(renderInline).join("");
|
|
@@ -190,5 +191,8 @@ function renderDocumentToHtml(document) {
|
|
|
190
191
|
renderer.render(document.children, false);
|
|
191
192
|
return renderer.result();
|
|
192
193
|
}
|
|
194
|
+
function assertNeverInlineNode(node) {
|
|
195
|
+
throw new Error(`markdown-codec: unhandled inline node ${JSON.stringify(node)}`);
|
|
196
|
+
}
|
|
193
197
|
//#endregion
|
|
194
|
-
export { escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
|
|
198
|
+
export { assertNeverInlineNode, escapeHref, escapeHtml, renderDocumentToHtml, renderInlines };
|
package/dist/inline/inline.cjs
CHANGED
|
@@ -478,11 +478,16 @@ function toAstNode(node) {
|
|
|
478
478
|
};
|
|
479
479
|
case "container": return;
|
|
480
480
|
}
|
|
481
|
+
return assertNeverInlineKind(node.kind);
|
|
481
482
|
}
|
|
482
483
|
function parseInlines(content, references, footnotes, options = {}) {
|
|
483
484
|
const root = new InlineParser(content, references, footnotes, options).parse();
|
|
484
485
|
if (options.gfmAutolinks ?? true) require_inline_gfm_autolink.applyGfmAutolinks(root);
|
|
485
486
|
return toChildAstNodes(root);
|
|
486
487
|
}
|
|
488
|
+
function assertNeverInlineKind(kind) {
|
|
489
|
+
throw new Error(`markdown-codec: unhandled inline kind ${JSON.stringify(kind)}`);
|
|
490
|
+
}
|
|
487
491
|
//#endregion
|
|
492
|
+
exports.assertNeverInlineKind = assertNeverInlineKind;
|
|
488
493
|
exports.parseInlines = parseInlines;
|
package/dist/inline/inline.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as parseInlines, t as InlineParseOptions } from "../inline-
|
|
2
|
-
export { InlineParseOptions, parseInlines };
|
|
1
|
+
import { n as assertNeverInlineKind, r as parseInlines, t as InlineParseOptions } from "../inline-B8WNyxnI.cjs";
|
|
2
|
+
export { InlineParseOptions, assertNeverInlineKind, parseInlines };
|
package/dist/inline/inline.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as parseInlines, t as InlineParseOptions } from "../inline-
|
|
2
|
-
export { InlineParseOptions, parseInlines };
|
|
1
|
+
import { n as assertNeverInlineKind, r as parseInlines, t as InlineParseOptions } from "../inline-BBtsaDjb.js";
|
|
2
|
+
export { InlineParseOptions, assertNeverInlineKind, parseInlines };
|
package/dist/inline/inline.js
CHANGED
|
@@ -477,11 +477,15 @@ function toAstNode(node) {
|
|
|
477
477
|
};
|
|
478
478
|
case "container": return;
|
|
479
479
|
}
|
|
480
|
+
return assertNeverInlineKind(node.kind);
|
|
480
481
|
}
|
|
481
482
|
function parseInlines(content, references, footnotes, options = {}) {
|
|
482
483
|
const root = new InlineParser(content, references, footnotes, options).parse();
|
|
483
484
|
if (options.gfmAutolinks ?? true) applyGfmAutolinks(root);
|
|
484
485
|
return toChildAstNodes(root);
|
|
485
486
|
}
|
|
487
|
+
function assertNeverInlineKind(kind) {
|
|
488
|
+
throw new Error(`markdown-codec: unhandled inline kind ${JSON.stringify(kind)}`);
|
|
489
|
+
}
|
|
486
490
|
//#endregion
|
|
487
|
-
export { parseInlines };
|
|
491
|
+
export { assertNeverInlineKind, parseInlines };
|
|
@@ -7,5 +7,6 @@ interface InlineParseOptions {
|
|
|
7
7
|
readonly gfmStrikethrough?: boolean;
|
|
8
8
|
}
|
|
9
9
|
declare function parseInlines(content: string, references: LinkReferenceMap, footnotes: FootnoteLabelSet, options?: InlineParseOptions): MarkdownInlineNode[];
|
|
10
|
+
declare function assertNeverInlineKind(kind: never): never;
|
|
10
11
|
//#endregion
|
|
11
|
-
export {
|
|
12
|
+
export { assertNeverInlineKind as n, parseInlines as r, InlineParseOptions as t };
|
|
@@ -7,5 +7,6 @@ interface InlineParseOptions {
|
|
|
7
7
|
readonly gfmStrikethrough?: boolean;
|
|
8
8
|
}
|
|
9
9
|
declare function parseInlines(content: string, references: LinkReferenceMap, footnotes: FootnoteLabelSet, options?: InlineParseOptions): MarkdownInlineNode[];
|
|
10
|
+
declare function assertNeverInlineKind(kind: never): never;
|
|
10
11
|
//#endregion
|
|
11
|
-
export {
|
|
12
|
+
export { assertNeverInlineKind as n, parseInlines as r, InlineParseOptions as t };
|
package/dist/lower/lower.cjs
CHANGED
|
@@ -318,6 +318,7 @@ function lowerBlock(node, context, contentWidthPt) {
|
|
|
318
318
|
case "tableRow":
|
|
319
319
|
case "tableCell": return [];
|
|
320
320
|
}
|
|
321
|
+
return assertNeverMarkdownBlock(node);
|
|
321
322
|
}
|
|
322
323
|
function lowerParsedMarkdown(parsed, options = {}, metadata = {}) {
|
|
323
324
|
const sink = options.sink ?? require_diagnostics_diagnostics.NOOP_MARKDOWN_DIAGNOSTIC_SINK;
|
|
@@ -378,7 +379,11 @@ function lowerMarkdownDetailed(source, options = {}) {
|
|
|
378
379
|
function lowerMarkdown(source, options = {}) {
|
|
379
380
|
return lowerMarkdownDetailed(source, options).document;
|
|
380
381
|
}
|
|
382
|
+
function assertNeverMarkdownBlock(node) {
|
|
383
|
+
throw new Error(`markdown-codec: unhandled markdown block ${JSON.stringify(node)}`);
|
|
384
|
+
}
|
|
381
385
|
//#endregion
|
|
386
|
+
exports.assertNeverMarkdownBlock = assertNeverMarkdownBlock;
|
|
382
387
|
exports.lowerMarkdown = lowerMarkdown;
|
|
383
388
|
exports.lowerMarkdownDetailed = lowerMarkdownDetailed;
|
|
384
389
|
exports.lowerParsedMarkdown = lowerParsedMarkdown;
|
package/dist/lower/lower.d.cts
CHANGED
|
@@ -11,5 +11,6 @@ interface LoweredMarkdownDetail {
|
|
|
11
11
|
}
|
|
12
12
|
declare function lowerMarkdownDetailed(source: string, options?: ReadMarkdownOptions): LoweredMarkdownDetail;
|
|
13
13
|
declare function lowerMarkdown(source: string, options?: ReadMarkdownOptions): ContentDocument;
|
|
14
|
+
declare function assertNeverMarkdownBlock(node: never): never;
|
|
14
15
|
//#endregion
|
|
15
|
-
export { LoweredMarkdownDetail, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
|
|
16
|
+
export { LoweredMarkdownDetail, assertNeverMarkdownBlock, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
|
package/dist/lower/lower.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ interface LoweredMarkdownDetail {
|
|
|
11
11
|
}
|
|
12
12
|
declare function lowerMarkdownDetailed(source: string, options?: ReadMarkdownOptions): LoweredMarkdownDetail;
|
|
13
13
|
declare function lowerMarkdown(source: string, options?: ReadMarkdownOptions): ContentDocument;
|
|
14
|
+
declare function assertNeverMarkdownBlock(node: never): never;
|
|
14
15
|
//#endregion
|
|
15
|
-
export { LoweredMarkdownDetail, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
|
|
16
|
+
export { LoweredMarkdownDetail, assertNeverMarkdownBlock, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
|
package/dist/lower/lower.js
CHANGED
|
@@ -317,6 +317,7 @@ function lowerBlock(node, context, contentWidthPt) {
|
|
|
317
317
|
case "tableRow":
|
|
318
318
|
case "tableCell": return [];
|
|
319
319
|
}
|
|
320
|
+
return assertNeverMarkdownBlock(node);
|
|
320
321
|
}
|
|
321
322
|
function lowerParsedMarkdown(parsed, options = {}, metadata = {}) {
|
|
322
323
|
const sink = options.sink ?? NOOP_MARKDOWN_DIAGNOSTIC_SINK;
|
|
@@ -377,5 +378,8 @@ function lowerMarkdownDetailed(source, options = {}) {
|
|
|
377
378
|
function lowerMarkdown(source, options = {}) {
|
|
378
379
|
return lowerMarkdownDetailed(source, options).document;
|
|
379
380
|
}
|
|
381
|
+
function assertNeverMarkdownBlock(node) {
|
|
382
|
+
throw new Error(`markdown-codec: unhandled markdown block ${JSON.stringify(node)}`);
|
|
383
|
+
}
|
|
380
384
|
//#endregion
|
|
381
|
-
export { lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
|
|
385
|
+
export { assertNeverMarkdownBlock, lowerMarkdown, lowerMarkdownDetailed, lowerParsedMarkdown };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-codec",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.8",
|
|
4
4
|
"description": "Hand-written CommonMark+GFM <-> DocumentTree codec, built on document-schema.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"packageManager": "pnpm@12.4.1+sha512.2e81e399d73fe8390dab25e06aa788ab7a5908248d2f5a370f82b481147a6a7a367bf8048f9a6fdb6460f21a66f0542dedb8b94ca2c8723596741920b1656d4c",
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"byte-codec": "2.0.1",
|
|
87
|
-
"document-schema.js": "7.15.
|
|
87
|
+
"document-schema.js": "7.15.2",
|
|
88
88
|
"zod": "4.4.3"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|