markdown-codec 4.0.15 → 4.1.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/README.md +14 -13
- package/dist/block/block.d.cts +3 -3
- package/dist/block/block.d.ts +3 -3
- package/dist/block/definitions.d.cts +2 -2
- package/dist/block/definitions.d.ts +2 -2
- package/dist/codec.d.cts +30 -10
- package/dist/codec.d.ts +30 -10
- package/dist/diagnostics/diagnostics.cjs +12 -4
- package/dist/diagnostics/diagnostics.d.cts +2 -2
- package/dist/diagnostics/diagnostics.d.ts +2 -2
- package/dist/diagnostics/diagnostics.js +12 -5
- package/dist/{diagnostics-BWK1iGy7.d.cts → diagnostics-CUMLtGHJ.d.cts} +7 -5
- package/dist/{diagnostics-BWK1iGy7.d.ts → diagnostics-CUMLtGHJ.d.ts} +7 -5
- package/dist/emit/emit.cjs +93 -27
- package/dist/emit/emit.js +96 -30
- package/dist/emit/inline.cjs +22 -14
- package/dist/emit/inline.d.cts +7 -5
- package/dist/emit/inline.d.ts +7 -5
- package/dist/emit/inline.js +21 -15
- package/dist/emit/table.cjs +1 -1
- package/dist/emit/table.d.cts +1 -1
- package/dist/emit/table.d.ts +1 -1
- package/dist/emit/table.js +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/inline/inline.d.cts +1 -1
- package/dist/inline/inline.d.ts +1 -1
- package/dist/inline/link.d.cts +17 -1
- package/dist/inline/link.d.ts +17 -1
- package/dist/{inline-CXVQWQnW.d.cts → inline-CoS1JzxI.d.cts} +1 -1
- package/dist/{inline-B_V7bs5j.d.ts → inline-OGXVE6hB.d.ts} +1 -1
- package/dist/lower/front-matter.cjs +7 -4
- package/dist/lower/front-matter.d.cts +2 -1
- package/dist/lower/front-matter.d.ts +2 -1
- package/dist/lower/front-matter.js +7 -4
- package/dist/lower/inline.cjs +73 -29
- package/dist/lower/inline.d.cts +7 -10
- package/dist/lower/inline.d.ts +7 -10
- package/dist/lower/inline.js +74 -29
- package/dist/lower/lower.cjs +140 -71
- package/dist/lower/lower.d.cts +8 -1
- package/dist/lower/lower.d.ts +8 -1
- package/dist/lower/lower.js +142 -74
- package/dist/lower/table.cjs +3 -2
- package/dist/lower/table.js +3 -2
- package/dist/options/options.d.cts +1 -1
- package/dist/options/options.d.ts +1 -1
- package/dist/read.cjs +45 -9
- package/dist/read.d.cts +1 -1
- package/dist/read.d.ts +1 -1
- package/dist/read.js +46 -10
- package/dist/shared/list-id.cjs +6 -0
- package/dist/shared/list-id.d.cts +2 -1
- package/dist/shared/list-id.d.ts +2 -1
- package/dist/shared/list-id.js +6 -1
- package/dist/write.cjs +31 -4
- package/dist/write.js +31 -4
- package/package.json +2 -2
- package/dist/link-Dv4kxVjk.d.cts +0 -18
- package/dist/link-Dv4kxVjk.d.ts +0 -18
package/dist/emit/inline.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
2
|
-
import { ContentRun } from "document-schema.js";
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CUMLtGHJ.js";
|
|
2
|
+
import { ContentRun, RunConstructExtent } from "document-schema.js";
|
|
3
3
|
//#region src/emit/inline.d.ts
|
|
4
4
|
interface InlineEmitContext {
|
|
5
5
|
readonly sink: MarkdownDiagnosticSink;
|
|
6
6
|
readonly emphasisMarker: string;
|
|
7
7
|
}
|
|
8
8
|
declare function escapeMarkdownText(text: string): string;
|
|
9
|
-
declare function
|
|
10
|
-
declare function
|
|
9
|
+
declare function escapeLinkDestination(destination: string): string;
|
|
10
|
+
declare function renderLinkTitle(title: string): string;
|
|
11
|
+
declare function emitRuns(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[] | undefined): string;
|
|
12
|
+
declare function emitRunsSingleLine(runs: readonly ContentRun[], context: InlineEmitContext, constructs?: readonly RunConstructExtent[] | undefined): string;
|
|
11
13
|
//#endregion
|
|
12
|
-
export { InlineEmitContext, emitRuns, emitRunsSingleLine, escapeMarkdownText };
|
|
14
|
+
export { InlineEmitContext, emitRuns, emitRunsSingleLine, escapeLinkDestination, escapeMarkdownText, renderLinkTitle };
|
package/dist/emit/inline.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MarkdownDiagnosticCodes } from "../diagnostics/diagnostics.js";
|
|
2
|
-
import { matchHtmlTag } from "../html/html.js";
|
|
3
2
|
import "../shared/style-constants.js";
|
|
4
3
|
//#region src/emit/inline.ts
|
|
5
4
|
const ESCAPE_CHARS = /* @__PURE__ */ new Set([
|
|
@@ -39,14 +38,6 @@ function escapeMarkdownText(text) {
|
|
|
39
38
|
let index = 0;
|
|
40
39
|
while (index < text.length) {
|
|
41
40
|
const char = text.charAt(index);
|
|
42
|
-
if (char === "<") {
|
|
43
|
-
const tag = matchHtmlTag(text, index);
|
|
44
|
-
if (tag !== void 0) {
|
|
45
|
-
out += tag;
|
|
46
|
-
index += tag.length;
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
41
|
if (char === "\n") {
|
|
51
42
|
out += "\\\n";
|
|
52
43
|
index += 1;
|
|
@@ -76,6 +67,7 @@ function renderCodeSpan(text) {
|
|
|
76
67
|
return risksFenceCollision || wouldBeStrippedOnReparse ? `${fence} ${text} ${fence}` : `${fence}${text}${fence}`;
|
|
77
68
|
}
|
|
78
69
|
function renderLeaf(run, context) {
|
|
70
|
+
if (run.source?.format === "markdown") return run.source.xml;
|
|
79
71
|
if (run.fontFamily === "Courier New") {
|
|
80
72
|
context.sink({
|
|
81
73
|
code: MarkdownDiagnosticCodes.CODE_SPAN_AS_MONOSPACE_RUN,
|
|
@@ -142,7 +134,20 @@ function escapeLinkDestination(destination) {
|
|
|
142
134
|
if (!/[\s()]/.test(destination)) return destination;
|
|
143
135
|
return `<${destination.replace(/[<>]/g, (char) => `\\${char}`)}>`;
|
|
144
136
|
}
|
|
145
|
-
function
|
|
137
|
+
function renderLinkTitle(title) {
|
|
138
|
+
return title.replace(/[\n\r]+/g, " ").replace(/["\\]/g, (char) => `\\${char}`);
|
|
139
|
+
}
|
|
140
|
+
function linkTitleCovering(constructs, start, end) {
|
|
141
|
+
let tightest;
|
|
142
|
+
for (const extent of constructs ?? []) {
|
|
143
|
+
if (extent.descriptor.kind !== "link" || extent.descriptor.title === void 0) continue;
|
|
144
|
+
if (extent.startRun > start || extent.endRun < end) continue;
|
|
145
|
+
const current = tightest;
|
|
146
|
+
if (current === void 0 || extent.startRun > current.startRun || extent.startRun === current.startRun && extent.endRun < current.endRun) tightest = extent;
|
|
147
|
+
}
|
|
148
|
+
return tightest?.descriptor.kind === "link" ? tightest.descriptor.title : void 0;
|
|
149
|
+
}
|
|
150
|
+
function emitRuns(runs, context, constructs = void 0) {
|
|
146
151
|
let out = "";
|
|
147
152
|
let index = 0;
|
|
148
153
|
while (index < runs.length) {
|
|
@@ -164,17 +169,18 @@ function emitRuns(runs, context) {
|
|
|
164
169
|
severity: "info",
|
|
165
170
|
message: `${String(group.length)} adjacent runs share the hyperlink "${hyperlink}"; markdown has no way to place two link boundaries back to back, so they render as one link spanning their combined text`
|
|
166
171
|
});
|
|
167
|
-
|
|
172
|
+
const title = linkTitleCovering(constructs, index, groupEnd);
|
|
173
|
+
if (title === void 0 && group.length === 1 && isPlainAutolink(group[0])) out += `<${group[0].text}>`;
|
|
168
174
|
else {
|
|
169
175
|
const linkText = renderNestedStyles(group, 0, context);
|
|
170
|
-
out += `[${linkText}](${escapeLinkDestination(hyperlink)})`;
|
|
176
|
+
out += `[${linkText}](${escapeLinkDestination(hyperlink)}${title === void 0 ? "" : ` "${renderLinkTitle(title)}"`})`;
|
|
171
177
|
}
|
|
172
178
|
index = groupEnd;
|
|
173
179
|
}
|
|
174
180
|
return out;
|
|
175
181
|
}
|
|
176
|
-
function emitRunsSingleLine(runs, context) {
|
|
177
|
-
return emitRuns(runs, context).replace(/\\\n/g, " ");
|
|
182
|
+
function emitRunsSingleLine(runs, context, constructs = void 0) {
|
|
183
|
+
return emitRuns(runs, context, constructs).replace(/\\\n/g, " ");
|
|
178
184
|
}
|
|
179
185
|
//#endregion
|
|
180
|
-
export { emitRuns, emitRunsSingleLine, escapeMarkdownText };
|
|
186
|
+
export { emitRuns, emitRunsSingleLine, escapeLinkDestination, escapeMarkdownText, renderLinkTitle };
|
package/dist/emit/table.cjs
CHANGED
|
@@ -54,7 +54,7 @@ function renderCellText(cell, context) {
|
|
|
54
54
|
});
|
|
55
55
|
continue;
|
|
56
56
|
}
|
|
57
|
-
const text = require_emit_inline.emitRunsSingleLine(block.runs, context);
|
|
57
|
+
const text = require_emit_inline.emitRunsSingleLine(block.runs, context, block.constructs);
|
|
58
58
|
if (text.length > 0) parts.push(text);
|
|
59
59
|
}
|
|
60
60
|
return escapeUnescapedPipes(parts.join(" "));
|
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-CUMLtGHJ.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-CUMLtGHJ.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/emit/table.js
CHANGED
|
@@ -53,7 +53,7 @@ function renderCellText(cell, context) {
|
|
|
53
53
|
});
|
|
54
54
|
continue;
|
|
55
55
|
}
|
|
56
|
-
const text = emitRunsSingleLine(block.runs, context);
|
|
56
|
+
const text = emitRunsSingleLine(block.runs, context, block.constructs);
|
|
57
57
|
if (text.length > 0) parts.push(text);
|
|
58
58
|
}
|
|
59
59
|
return escapeUnescapedPipes(parts.join(" "));
|
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ exports.MONOSPACE_FONT_FAMILY = require_shared_style_constants.MONOSPACE_FONT_FA
|
|
|
14
14
|
exports.MarkdownBytesSchema = require_codec.MarkdownBytesSchema;
|
|
15
15
|
exports.MarkdownDiagnosticCodes = require_diagnostics_diagnostics.MarkdownDiagnosticCodes;
|
|
16
16
|
exports.MarkdownInputTooLargeError = require_diagnostics_diagnostics.MarkdownInputTooLargeError;
|
|
17
|
+
exports.MarkdownInvalidRunConstructExtentError = require_diagnostics_diagnostics.MarkdownInvalidRunConstructExtentError;
|
|
17
18
|
exports.MarkdownInvalidUtf8Error = require_diagnostics_diagnostics.MarkdownInvalidUtf8Error;
|
|
18
19
|
exports.MarkdownNestingLimitExceededError = require_diagnostics_diagnostics.MarkdownNestingLimitExceededError;
|
|
19
20
|
exports.MarkdownParseError = require_diagnostics_diagnostics.MarkdownParseError;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MarkdownInputTooLargeError, d as
|
|
1
|
+
import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "./diagnostics-CUMLtGHJ.cjs";
|
|
2
2
|
import { MarkdownBytesSchema, markdownCodec, markdownContentCodec } from "./codec.cjs";
|
|
3
3
|
import { n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "./image-C4KYmz_L.cjs";
|
|
4
4
|
import { MarkdownBulletListMarker, MarkdownCodeFenceChar, MarkdownEmphasisMarker, MarkdownHeadingStyle, MarkdownLineEnding, MarkdownOrderedListDelimiter, MarkdownThematicBreakChar, ReadMarkdownOptions, WriteMarkdownOptions, WriteMarkdownStyleOptions } from "./options/options.cjs";
|
|
@@ -6,4 +6,4 @@ import { ReadMarkdownContentResult, ReadMarkdownResult, readMarkdown, readMarkdo
|
|
|
6
6
|
import { writeMarkdown, writeMarkdownContent } from "./write.cjs";
|
|
7
7
|
import { ListNumIdInfo, ListNumIdMintOptions, NumIdMintState, createNumIdMintState, mintListNumId, mintedListType, parseListNumId } from "./shared/list-id.cjs";
|
|
8
8
|
import { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, headingStyleId, parseHeadingStyleId } from "./shared/style-constants.cjs";
|
|
9
|
-
export { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, type ListNumIdInfo, type ListNumIdMintOptions, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, type MarkdownBulletListMarker, MarkdownBytesSchema, type MarkdownCodeFenceChar, type MarkdownDiagnostic, MarkdownDiagnosticCodes, type MarkdownDiagnosticSeverity, type MarkdownDiagnosticSink, type MarkdownEmphasisMarker, type MarkdownHeadingStyle, type MarkdownImageResolveContext, type MarkdownImageResolver, MarkdownInputTooLargeError, MarkdownInvalidUtf8Error, type MarkdownLineEnding, MarkdownNestingLimitExceededError, type MarkdownOrderedListDelimiter, MarkdownParseError, type MarkdownResolvedImageBytes, type MarkdownThematicBreakChar, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, type NumIdMintState, QUOTE_INDENT_PT, QUOTE_STYLE_ID, type ReadMarkdownContentResult, type ReadMarkdownOptions, type ReadMarkdownResult, type WriteMarkdownOptions, type WriteMarkdownStyleOptions, createNumIdMintState, headingStyleId, markdownCodec, markdownContentCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, readMarkdownContent, writeMarkdown, writeMarkdownContent };
|
|
9
|
+
export { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, type ListNumIdInfo, type ListNumIdMintOptions, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, type MarkdownBulletListMarker, MarkdownBytesSchema, type MarkdownCodeFenceChar, type MarkdownDiagnostic, MarkdownDiagnosticCodes, type MarkdownDiagnosticSeverity, type MarkdownDiagnosticSink, type MarkdownEmphasisMarker, type MarkdownHeadingStyle, type MarkdownImageResolveContext, type MarkdownImageResolver, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownInvalidUtf8Error, type MarkdownLineEnding, MarkdownNestingLimitExceededError, type MarkdownOrderedListDelimiter, MarkdownParseError, type MarkdownResolvedImageBytes, type MarkdownThematicBreakChar, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, type NumIdMintState, QUOTE_INDENT_PT, QUOTE_STYLE_ID, type ReadMarkdownContentResult, type ReadMarkdownOptions, type ReadMarkdownResult, type WriteMarkdownOptions, type WriteMarkdownStyleOptions, createNumIdMintState, headingStyleId, markdownCodec, markdownContentCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, readMarkdownContent, writeMarkdown, writeMarkdownContent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MarkdownInputTooLargeError, d as
|
|
1
|
+
import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "./diagnostics-CUMLtGHJ.js";
|
|
2
2
|
import { MarkdownBytesSchema, markdownCodec, markdownContentCodec } from "./codec.js";
|
|
3
3
|
import { n as MarkdownImageResolver, r as MarkdownResolvedImageBytes, t as MarkdownImageResolveContext } from "./image-Cm3hT5PS.js";
|
|
4
4
|
import { MarkdownBulletListMarker, MarkdownCodeFenceChar, MarkdownEmphasisMarker, MarkdownHeadingStyle, MarkdownLineEnding, MarkdownOrderedListDelimiter, MarkdownThematicBreakChar, ReadMarkdownOptions, WriteMarkdownOptions, WriteMarkdownStyleOptions } from "./options/options.js";
|
|
@@ -6,4 +6,4 @@ import { ReadMarkdownContentResult, ReadMarkdownResult, readMarkdown, readMarkdo
|
|
|
6
6
|
import { writeMarkdown, writeMarkdownContent } from "./write.js";
|
|
7
7
|
import { ListNumIdInfo, ListNumIdMintOptions, NumIdMintState, createNumIdMintState, mintListNumId, mintedListType, parseListNumId } from "./shared/list-id.js";
|
|
8
8
|
import { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, headingStyleId, parseHeadingStyleId } from "./shared/style-constants.js";
|
|
9
|
-
export { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, type ListNumIdInfo, type ListNumIdMintOptions, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, type MarkdownBulletListMarker, MarkdownBytesSchema, type MarkdownCodeFenceChar, type MarkdownDiagnostic, MarkdownDiagnosticCodes, type MarkdownDiagnosticSeverity, type MarkdownDiagnosticSink, type MarkdownEmphasisMarker, type MarkdownHeadingStyle, type MarkdownImageResolveContext, type MarkdownImageResolver, MarkdownInputTooLargeError, MarkdownInvalidUtf8Error, type MarkdownLineEnding, MarkdownNestingLimitExceededError, type MarkdownOrderedListDelimiter, MarkdownParseError, type MarkdownResolvedImageBytes, type MarkdownThematicBreakChar, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, type NumIdMintState, QUOTE_INDENT_PT, QUOTE_STYLE_ID, type ReadMarkdownContentResult, type ReadMarkdownOptions, type ReadMarkdownResult, type WriteMarkdownOptions, type WriteMarkdownStyleOptions, createNumIdMintState, headingStyleId, markdownCodec, markdownContentCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, readMarkdownContent, writeMarkdown, writeMarkdownContent };
|
|
9
|
+
export { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, type ListNumIdInfo, type ListNumIdMintOptions, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, type MarkdownBulletListMarker, MarkdownBytesSchema, type MarkdownCodeFenceChar, type MarkdownDiagnostic, MarkdownDiagnosticCodes, type MarkdownDiagnosticSeverity, type MarkdownDiagnosticSink, type MarkdownEmphasisMarker, type MarkdownHeadingStyle, type MarkdownImageResolveContext, type MarkdownImageResolver, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownInvalidUtf8Error, type MarkdownLineEnding, MarkdownNestingLimitExceededError, type MarkdownOrderedListDelimiter, MarkdownParseError, type MarkdownResolvedImageBytes, type MarkdownThematicBreakChar, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, type NumIdMintState, QUOTE_INDENT_PT, QUOTE_STYLE_ID, type ReadMarkdownContentResult, type ReadMarkdownOptions, type ReadMarkdownResult, type WriteMarkdownOptions, type WriteMarkdownStyleOptions, createNumIdMintState, headingStyleId, markdownCodec, markdownContentCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, readMarkdownContent, writeMarkdown, writeMarkdownContent };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MarkdownDiagnosticCodes, MarkdownInputTooLargeError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownParseError, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK } from "./diagnostics/diagnostics.js";
|
|
1
|
+
import { MarkdownDiagnosticCodes, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownParseError, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK } from "./diagnostics/diagnostics.js";
|
|
2
2
|
import { createNumIdMintState, mintListNumId, mintedListType, parseListNumId } from "./shared/list-id.js";
|
|
3
3
|
import { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, headingStyleId, parseHeadingStyleId } from "./shared/style-constants.js";
|
|
4
4
|
import { readMarkdown, readMarkdownContent } from "./read.js";
|
|
5
5
|
import { writeMarkdown, writeMarkdownContent } from "./write.js";
|
|
6
6
|
import { MarkdownBytesSchema, markdownCodec, markdownContentCodec } from "./codec.js";
|
|
7
|
-
export { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, MarkdownBytesSchema, MarkdownDiagnosticCodes, MarkdownInputTooLargeError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownParseError, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, QUOTE_INDENT_PT, QUOTE_STYLE_ID, createNumIdMintState, headingStyleId, markdownCodec, markdownContentCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, readMarkdownContent, writeMarkdown, writeMarkdownContent };
|
|
7
|
+
export { CODE_BLOCK_STYLE_ID, FOOTNOTE_REFERENCE_FONT_MARKER, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, MarkdownBytesSchema, MarkdownDiagnosticCodes, MarkdownInputTooLargeError, MarkdownInvalidRunConstructExtentError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownParseError, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, QUOTE_INDENT_PT, QUOTE_STYLE_ID, createNumIdMintState, headingStyleId, markdownCodec, markdownContentCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, readMarkdownContent, writeMarkdown, writeMarkdownContent };
|
package/dist/inline/inline.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as parseInlines, t as InlineParseOptions } from "../inline-
|
|
1
|
+
import { n as parseInlines, t as InlineParseOptions } from "../inline-CoS1JzxI.cjs";
|
|
2
2
|
export { InlineParseOptions, parseInlines };
|
package/dist/inline/inline.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as parseInlines, t as InlineParseOptions } from "../inline-
|
|
1
|
+
import { n as parseInlines, t as InlineParseOptions } from "../inline-OGXVE6hB.js";
|
|
2
2
|
export { InlineParseOptions, parseInlines };
|
package/dist/inline/link.d.cts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/inline/link.d.ts
|
|
2
|
+
interface LinkReferenceDefinition {
|
|
3
|
+
readonly destination: string;
|
|
4
|
+
readonly title?: string;
|
|
5
|
+
}
|
|
6
|
+
type LinkReferenceMap = ReadonlyMap<string, LinkReferenceDefinition>;
|
|
7
|
+
declare function normalizeLinkLabel(labelWithBrackets: string): string;
|
|
8
|
+
declare function matchLinkLabel(text: string, start: number): number;
|
|
9
|
+
interface ParsedSpan {
|
|
10
|
+
readonly value: string;
|
|
11
|
+
readonly end: number;
|
|
12
|
+
}
|
|
13
|
+
declare function parseLinkDestination(text: string, start: number): ParsedSpan | undefined;
|
|
14
|
+
declare function parseLinkTitle(text: string, start: number): ParsedSpan | undefined;
|
|
15
|
+
declare function skipInlineWhitespace(text: string, start: number): number;
|
|
16
|
+
declare function isBlankRemainderOfLine(text: string, start: number): boolean;
|
|
17
|
+
//#endregion
|
|
2
18
|
export { LinkReferenceDefinition, LinkReferenceMap, ParsedSpan, isBlankRemainderOfLine, matchLinkLabel, normalizeLinkLabel, parseLinkDestination, parseLinkTitle, skipInlineWhitespace };
|
package/dist/inline/link.d.ts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/inline/link.d.ts
|
|
2
|
+
interface LinkReferenceDefinition {
|
|
3
|
+
readonly destination: string;
|
|
4
|
+
readonly title?: string;
|
|
5
|
+
}
|
|
6
|
+
type LinkReferenceMap = ReadonlyMap<string, LinkReferenceDefinition>;
|
|
7
|
+
declare function normalizeLinkLabel(labelWithBrackets: string): string;
|
|
8
|
+
declare function matchLinkLabel(text: string, start: number): number;
|
|
9
|
+
interface ParsedSpan {
|
|
10
|
+
readonly value: string;
|
|
11
|
+
readonly end: number;
|
|
12
|
+
}
|
|
13
|
+
declare function parseLinkDestination(text: string, start: number): ParsedSpan | undefined;
|
|
14
|
+
declare function parseLinkTitle(text: string, start: number): ParsedSpan | undefined;
|
|
15
|
+
declare function skipInlineWhitespace(text: string, start: number): number;
|
|
16
|
+
declare function isBlankRemainderOfLine(text: string, start: number): boolean;
|
|
17
|
+
//#endregion
|
|
2
18
|
export { LinkReferenceDefinition, LinkReferenceMap, ParsedSpan, isBlankRemainderOfLine, matchLinkLabel, normalizeLinkLabel, parseLinkDestination, parseLinkTitle, skipInlineWhitespace };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v as MarkdownInlineNode } from "./ast-8XCbjRQT.cjs";
|
|
2
2
|
import { r as FootnoteLabelSet } from "./footnote-CKk4JbLk.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { LinkReferenceMap } from "./inline/link.cjs";
|
|
4
4
|
//#region src/inline/inline.d.ts
|
|
5
5
|
interface InlineParseOptions {
|
|
6
6
|
readonly gfmAutolinks?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v as MarkdownInlineNode } from "./ast-8XCbjRQT.js";
|
|
2
2
|
import { r as FootnoteLabelSet } from "./footnote-CKk4JbLk.js";
|
|
3
|
-
import {
|
|
3
|
+
import { LinkReferenceMap } from "./inline/link.js";
|
|
4
4
|
//#region src/inline/inline.d.ts
|
|
5
5
|
interface InlineParseOptions {
|
|
6
6
|
readonly gfmAutolinks?: boolean;
|
|
@@ -20,7 +20,8 @@ function extractFrontMatter(source, sink = require_diagnostics_diagnostics.NOOP_
|
|
|
20
20
|
const firstLine = lines[0];
|
|
21
21
|
if (firstLine === void 0 || !LEADING_DELIMITER_PATTERN.test(firstLine)) return {
|
|
22
22
|
metadata: {},
|
|
23
|
-
rest: source
|
|
23
|
+
rest: source,
|
|
24
|
+
source: void 0
|
|
24
25
|
};
|
|
25
26
|
let closingIndex = -1;
|
|
26
27
|
for (let index = 1; index < lines.length; index += 1) if (CLOSING_DELIMITER_PATTERN.test(lines[index] ?? "")) {
|
|
@@ -29,7 +30,8 @@ function extractFrontMatter(source, sink = require_diagnostics_diagnostics.NOOP_
|
|
|
29
30
|
}
|
|
30
31
|
if (closingIndex === -1) return {
|
|
31
32
|
metadata: {},
|
|
32
|
-
rest: source
|
|
33
|
+
rest: source,
|
|
34
|
+
source: void 0
|
|
33
35
|
};
|
|
34
36
|
const metadata = {};
|
|
35
37
|
for (let index = 1; index < closingIndex; index += 1) {
|
|
@@ -61,14 +63,15 @@ function extractFrontMatter(source, sink = require_diagnostics_diagnostics.NOOP_
|
|
|
61
63
|
default: sink({
|
|
62
64
|
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.FRONT_MATTER_KEY_UNMAPPED,
|
|
63
65
|
severity: "info",
|
|
64
|
-
message: `front matter key "${key}" has no LayoutMetadata equivalent and was dropped`,
|
|
66
|
+
message: `front matter key "${key}" has no LayoutMetadata equivalent and was dropped from the metadata; its original spelling survives in the verbatim front-matter block this package's own writer can re-emit`,
|
|
65
67
|
line: index + 1
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
return {
|
|
70
72
|
metadata,
|
|
71
|
-
rest: lines.slice(closingIndex + 1).join("\n")
|
|
73
|
+
rest: lines.slice(closingIndex + 1).join("\n"),
|
|
74
|
+
source: lines.slice(0, closingIndex + 1).join("\n")
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
77
|
//#endregion
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CUMLtGHJ.cjs";
|
|
2
2
|
import { LayoutMetadata } from "document-schema.js";
|
|
3
3
|
//#region src/lower/front-matter.d.ts
|
|
4
4
|
interface FrontMatterResult {
|
|
5
5
|
readonly metadata: LayoutMetadata;
|
|
6
6
|
readonly rest: string;
|
|
7
|
+
readonly source: string | undefined;
|
|
7
8
|
}
|
|
8
9
|
declare function extractFrontMatter(source: string, sink?: MarkdownDiagnosticSink): FrontMatterResult;
|
|
9
10
|
//#endregion
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
1
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CUMLtGHJ.js";
|
|
2
2
|
import { LayoutMetadata } from "document-schema.js";
|
|
3
3
|
//#region src/lower/front-matter.d.ts
|
|
4
4
|
interface FrontMatterResult {
|
|
5
5
|
readonly metadata: LayoutMetadata;
|
|
6
6
|
readonly rest: string;
|
|
7
|
+
readonly source: string | undefined;
|
|
7
8
|
}
|
|
8
9
|
declare function extractFrontMatter(source: string, sink?: MarkdownDiagnosticSink): FrontMatterResult;
|
|
9
10
|
//#endregion
|
|
@@ -19,7 +19,8 @@ function extractFrontMatter(source, sink = NOOP_MARKDOWN_DIAGNOSTIC_SINK) {
|
|
|
19
19
|
const firstLine = lines[0];
|
|
20
20
|
if (firstLine === void 0 || !LEADING_DELIMITER_PATTERN.test(firstLine)) return {
|
|
21
21
|
metadata: {},
|
|
22
|
-
rest: source
|
|
22
|
+
rest: source,
|
|
23
|
+
source: void 0
|
|
23
24
|
};
|
|
24
25
|
let closingIndex = -1;
|
|
25
26
|
for (let index = 1; index < lines.length; index += 1) if (CLOSING_DELIMITER_PATTERN.test(lines[index] ?? "")) {
|
|
@@ -28,7 +29,8 @@ function extractFrontMatter(source, sink = NOOP_MARKDOWN_DIAGNOSTIC_SINK) {
|
|
|
28
29
|
}
|
|
29
30
|
if (closingIndex === -1) return {
|
|
30
31
|
metadata: {},
|
|
31
|
-
rest: source
|
|
32
|
+
rest: source,
|
|
33
|
+
source: void 0
|
|
32
34
|
};
|
|
33
35
|
const metadata = {};
|
|
34
36
|
for (let index = 1; index < closingIndex; index += 1) {
|
|
@@ -60,14 +62,15 @@ function extractFrontMatter(source, sink = NOOP_MARKDOWN_DIAGNOSTIC_SINK) {
|
|
|
60
62
|
default: sink({
|
|
61
63
|
code: MarkdownDiagnosticCodes.FRONT_MATTER_KEY_UNMAPPED,
|
|
62
64
|
severity: "info",
|
|
63
|
-
message: `front matter key "${key}" has no LayoutMetadata equivalent and was dropped`,
|
|
65
|
+
message: `front matter key "${key}" has no LayoutMetadata equivalent and was dropped from the metadata; its original spelling survives in the verbatim front-matter block this package's own writer can re-emit`,
|
|
64
66
|
line: index + 1
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
return {
|
|
69
71
|
metadata,
|
|
70
|
-
rest: lines.slice(closingIndex + 1).join("\n")
|
|
72
|
+
rest: lines.slice(closingIndex + 1).join("\n"),
|
|
73
|
+
source: lines.slice(0, closingIndex + 1).join("\n")
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
76
|
//#endregion
|
package/dist/lower/inline.cjs
CHANGED
|
@@ -12,7 +12,7 @@ function buildRun(text, style, fontFamily) {
|
|
|
12
12
|
...fontFamily !== void 0 ? { fontFamily } : {}
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
function lowerNestedEmphasisLike(kind, node, style, context) {
|
|
15
|
+
function lowerNestedEmphasisLike(kind, node, style, context, runs, extents) {
|
|
16
16
|
if (style[kind] === true) context.sink({
|
|
17
17
|
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.NESTED_EMPHASIS_FLATTENED,
|
|
18
18
|
severity: "info",
|
|
@@ -22,15 +22,25 @@ function lowerNestedEmphasisLike(kind, node, style, context) {
|
|
|
22
22
|
...style,
|
|
23
23
|
[kind]: true
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
lowerNodesInto(node.children, childStyle, context, runs, extents);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function lowerInlineNodeInto(node, style, context, runs, extents) {
|
|
28
28
|
switch (node.type) {
|
|
29
|
-
case "text":
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
case "
|
|
33
|
-
|
|
29
|
+
case "text":
|
|
30
|
+
if (node.value.length > 0) runs.push(buildRun(node.value, style));
|
|
31
|
+
return;
|
|
32
|
+
case "entity":
|
|
33
|
+
if (node.value.length > 0) runs.push(buildRun(node.value, style));
|
|
34
|
+
return;
|
|
35
|
+
case "softBreak":
|
|
36
|
+
runs.push(buildRun(" ", style));
|
|
37
|
+
return;
|
|
38
|
+
case "hardBreak":
|
|
39
|
+
runs.push(buildRun("\n", style));
|
|
40
|
+
return;
|
|
41
|
+
case "codeSpan":
|
|
42
|
+
runs.push(buildRun(node.literal, style, require_shared_style_constants.MONOSPACE_FONT_FAMILY));
|
|
43
|
+
return;
|
|
34
44
|
case "rawHtml":
|
|
35
45
|
if (context.rawHtml === "drop") {
|
|
36
46
|
context.sink({
|
|
@@ -38,47 +48,66 @@ function lowerInlineNode(node, style, context) {
|
|
|
38
48
|
severity: "info",
|
|
39
49
|
message: "inline raw HTML was dropped per the rawHtml: \"drop\" option"
|
|
40
50
|
});
|
|
41
|
-
return
|
|
51
|
+
return;
|
|
42
52
|
}
|
|
43
53
|
context.sink({
|
|
44
54
|
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.RAW_HTML_PRESERVED_AS_TEXT,
|
|
45
55
|
severity: "info",
|
|
46
|
-
message: "inline raw HTML was preserved as literal text; it will not be rendered as HTML by any consumer of the resulting ContentDocument"
|
|
56
|
+
message: "inline raw HTML was preserved as literal text; it will not be rendered as HTML by any consumer of the resulting ContentDocument, and its verbatim original rides the run's own markdown residue for this package's writer to re-emit as-is"
|
|
47
57
|
});
|
|
48
|
-
|
|
58
|
+
if (node.literal.length > 0) runs.push({
|
|
59
|
+
...buildRun(node.literal, style),
|
|
60
|
+
source: {
|
|
61
|
+
format: "markdown",
|
|
62
|
+
xml: node.literal
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return;
|
|
49
66
|
case "mathInline":
|
|
50
67
|
context.sink({
|
|
51
68
|
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.MATH_INLINE_PRESERVED_AS_TEXT,
|
|
52
69
|
severity: "info",
|
|
53
70
|
message: "inline math (\\( \\)) was preserved as literal raw LaTeX text; it is not parsed as LaTeX or converted to MathML by this package"
|
|
54
71
|
});
|
|
55
|
-
|
|
72
|
+
runs.push(buildRun(node.literal, style, require_shared_style_constants.MATH_INLINE_FONT_MARKER));
|
|
73
|
+
return;
|
|
56
74
|
case "footnoteReference":
|
|
57
75
|
context.sink({
|
|
58
76
|
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.FOOTNOTE_REFERENCE_PRESERVED_AS_TEXT,
|
|
59
77
|
severity: "info",
|
|
60
78
|
message: `footnote reference "[^${node.label}]" is preserved as a marked text run rather than an anchor construct: a construct's extent is block-scoped, and a reference site sits between two runs inside a paragraph, which no block-level boundary marker can bracket`
|
|
61
79
|
});
|
|
62
|
-
|
|
80
|
+
runs.push(buildRun(`[^${node.label}]`, style, require_shared_style_constants.FOOTNOTE_REFERENCE_FONT_MARKER));
|
|
81
|
+
return;
|
|
63
82
|
case "autolink": {
|
|
64
83
|
const destination = node.email ? `mailto:${node.destination}` : node.destination;
|
|
65
|
-
|
|
84
|
+
runs.push(buildRun(node.destination, {
|
|
66
85
|
...style,
|
|
67
86
|
hyperlink: destination
|
|
68
|
-
})
|
|
87
|
+
}));
|
|
88
|
+
return;
|
|
69
89
|
}
|
|
70
90
|
case "link": {
|
|
71
|
-
if (node.title !== void 0) context.sink({
|
|
72
|
-
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.LINK_TITLE_DROPPED,
|
|
73
|
-
severity: "info",
|
|
74
|
-
message: `link title "${node.title}" has no ContentRun equivalent and was dropped`
|
|
75
|
-
});
|
|
76
91
|
const childStyle = {
|
|
77
92
|
...style,
|
|
78
93
|
hyperlink: node.destination
|
|
79
94
|
};
|
|
80
|
-
const
|
|
81
|
-
|
|
95
|
+
const startRun = runs.length;
|
|
96
|
+
lowerNodesInto(node.children, childStyle, context, runs, extents);
|
|
97
|
+
if (runs.length === startRun) runs.push(buildRun("", childStyle));
|
|
98
|
+
if (node.title !== void 0) extents.push({
|
|
99
|
+
descriptor: {
|
|
100
|
+
kind: "link",
|
|
101
|
+
target: {
|
|
102
|
+
kind: "external",
|
|
103
|
+
uri: node.destination
|
|
104
|
+
},
|
|
105
|
+
title: node.title
|
|
106
|
+
},
|
|
107
|
+
startRun,
|
|
108
|
+
endRun: runs.length
|
|
109
|
+
});
|
|
110
|
+
return;
|
|
82
111
|
}
|
|
83
112
|
case "image":
|
|
84
113
|
if (node.title !== void 0) context.sink({
|
|
@@ -86,17 +115,33 @@ function lowerInlineNode(node, style, context) {
|
|
|
86
115
|
severity: "info",
|
|
87
116
|
message: `image title "${node.title}" has no ContentRun equivalent and was dropped`
|
|
88
117
|
});
|
|
89
|
-
|
|
118
|
+
runs.push(buildRun(node.alt, {
|
|
90
119
|
...style,
|
|
91
120
|
hyperlink: node.destination
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
case "
|
|
95
|
-
|
|
121
|
+
}));
|
|
122
|
+
return;
|
|
123
|
+
case "emphasis":
|
|
124
|
+
lowerNestedEmphasisLike("italic", node, style, context, runs, extents);
|
|
125
|
+
return;
|
|
126
|
+
case "strong":
|
|
127
|
+
lowerNestedEmphasisLike("bold", node, style, context, runs, extents);
|
|
128
|
+
return;
|
|
129
|
+
case "strikethrough":
|
|
130
|
+
lowerNestedEmphasisLike("strike", node, style, context, runs, extents);
|
|
131
|
+
return;
|
|
96
132
|
}
|
|
97
133
|
}
|
|
134
|
+
function lowerNodesInto(nodes, style, context, runs, extents) {
|
|
135
|
+
for (const node of nodes) lowerInlineNodeInto(node, style, context, runs, extents);
|
|
136
|
+
}
|
|
98
137
|
function lowerInlineNodes(nodes, context) {
|
|
99
|
-
|
|
138
|
+
const runs = [];
|
|
139
|
+
const extents = [];
|
|
140
|
+
lowerNodesInto(nodes, {}, context, runs, extents);
|
|
141
|
+
return {
|
|
142
|
+
runs,
|
|
143
|
+
linkTitleExtents: extents
|
|
144
|
+
};
|
|
100
145
|
}
|
|
101
146
|
function lowerCodeBlockRun(literal) {
|
|
102
147
|
return {
|
|
@@ -106,5 +151,4 @@ function lowerCodeBlockRun(literal) {
|
|
|
106
151
|
}
|
|
107
152
|
//#endregion
|
|
108
153
|
exports.lowerCodeBlockRun = lowerCodeBlockRun;
|
|
109
|
-
exports.lowerInlineNode = lowerInlineNode;
|
|
110
154
|
exports.lowerInlineNodes = lowerInlineNodes;
|
package/dist/lower/inline.d.cts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { v as MarkdownInlineNode } from "../ast-8XCbjRQT.cjs";
|
|
2
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
3
|
-
import { ContentRun } from "document-schema.js";
|
|
2
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CUMLtGHJ.cjs";
|
|
3
|
+
import { ContentRun, RunConstructExtent } from "document-schema.js";
|
|
4
4
|
//#region src/lower/inline.d.ts
|
|
5
5
|
interface InlineLowerContext {
|
|
6
6
|
readonly sink: MarkdownDiagnosticSink;
|
|
7
7
|
readonly rawHtml: 'preserve' | 'drop';
|
|
8
8
|
}
|
|
9
|
-
interface
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly strike?: boolean;
|
|
13
|
-
readonly hyperlink?: string;
|
|
9
|
+
interface InlineLowerResult {
|
|
10
|
+
readonly runs: ContentRun[];
|
|
11
|
+
readonly linkTitleExtents: readonly RunConstructExtent[];
|
|
14
12
|
}
|
|
15
|
-
declare function
|
|
16
|
-
declare function lowerInlineNodes(nodes: readonly MarkdownInlineNode[], context: InlineLowerContext): ContentRun[];
|
|
13
|
+
declare function lowerInlineNodes(nodes: readonly MarkdownInlineNode[], context: InlineLowerContext): InlineLowerResult;
|
|
17
14
|
declare function lowerCodeBlockRun(literal: string): ContentRun;
|
|
18
15
|
//#endregion
|
|
19
|
-
export { InlineLowerContext,
|
|
16
|
+
export { InlineLowerContext, InlineLowerResult, lowerCodeBlockRun, lowerInlineNodes };
|
package/dist/lower/inline.d.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { v as MarkdownInlineNode } from "../ast-8XCbjRQT.js";
|
|
2
|
-
import { i as MarkdownDiagnosticSink } from "../diagnostics-
|
|
3
|
-
import { ContentRun } from "document-schema.js";
|
|
2
|
+
import { i as MarkdownDiagnosticSink } from "../diagnostics-CUMLtGHJ.js";
|
|
3
|
+
import { ContentRun, RunConstructExtent } from "document-schema.js";
|
|
4
4
|
//#region src/lower/inline.d.ts
|
|
5
5
|
interface InlineLowerContext {
|
|
6
6
|
readonly sink: MarkdownDiagnosticSink;
|
|
7
7
|
readonly rawHtml: 'preserve' | 'drop';
|
|
8
8
|
}
|
|
9
|
-
interface
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly strike?: boolean;
|
|
13
|
-
readonly hyperlink?: string;
|
|
9
|
+
interface InlineLowerResult {
|
|
10
|
+
readonly runs: ContentRun[];
|
|
11
|
+
readonly linkTitleExtents: readonly RunConstructExtent[];
|
|
14
12
|
}
|
|
15
|
-
declare function
|
|
16
|
-
declare function lowerInlineNodes(nodes: readonly MarkdownInlineNode[], context: InlineLowerContext): ContentRun[];
|
|
13
|
+
declare function lowerInlineNodes(nodes: readonly MarkdownInlineNode[], context: InlineLowerContext): InlineLowerResult;
|
|
17
14
|
declare function lowerCodeBlockRun(literal: string): ContentRun;
|
|
18
15
|
//#endregion
|
|
19
|
-
export { InlineLowerContext,
|
|
16
|
+
export { InlineLowerContext, InlineLowerResult, lowerCodeBlockRun, lowerInlineNodes };
|