markdown-codec 4.0.15 → 4.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.
Files changed (62) hide show
  1. package/README.md +13 -12
  2. package/dist/block/block.d.cts +3 -3
  3. package/dist/block/block.d.ts +3 -3
  4. package/dist/block/definitions.d.cts +2 -2
  5. package/dist/block/definitions.d.ts +2 -2
  6. package/dist/codec.d.cts +20 -0
  7. package/dist/codec.d.ts +20 -0
  8. package/dist/diagnostics/diagnostics.cjs +12 -4
  9. package/dist/diagnostics/diagnostics.d.cts +2 -2
  10. package/dist/diagnostics/diagnostics.d.ts +2 -2
  11. package/dist/diagnostics/diagnostics.js +12 -5
  12. package/dist/{diagnostics-BWK1iGy7.d.cts → diagnostics-CUMLtGHJ.d.cts} +7 -5
  13. package/dist/{diagnostics-BWK1iGy7.d.ts → diagnostics-CUMLtGHJ.d.ts} +7 -5
  14. package/dist/emit/emit.cjs +93 -27
  15. package/dist/emit/emit.js +96 -30
  16. package/dist/emit/inline.cjs +22 -14
  17. package/dist/emit/inline.d.cts +7 -5
  18. package/dist/emit/inline.d.ts +7 -5
  19. package/dist/emit/inline.js +21 -15
  20. package/dist/emit/table.cjs +1 -1
  21. package/dist/emit/table.d.cts +1 -1
  22. package/dist/emit/table.d.ts +1 -1
  23. package/dist/emit/table.js +1 -1
  24. package/dist/index.cjs +1 -0
  25. package/dist/index.d.cts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +2 -2
  28. package/dist/inline/inline.d.cts +1 -1
  29. package/dist/inline/inline.d.ts +1 -1
  30. package/dist/inline/link.d.cts +17 -1
  31. package/dist/inline/link.d.ts +17 -1
  32. package/dist/{inline-CXVQWQnW.d.cts → inline-CoS1JzxI.d.cts} +1 -1
  33. package/dist/{inline-B_V7bs5j.d.ts → inline-OGXVE6hB.d.ts} +1 -1
  34. package/dist/lower/front-matter.cjs +7 -4
  35. package/dist/lower/front-matter.d.cts +2 -1
  36. package/dist/lower/front-matter.d.ts +2 -1
  37. package/dist/lower/front-matter.js +7 -4
  38. package/dist/lower/inline.cjs +73 -29
  39. package/dist/lower/inline.d.cts +7 -10
  40. package/dist/lower/inline.d.ts +7 -10
  41. package/dist/lower/inline.js +74 -29
  42. package/dist/lower/lower.cjs +140 -71
  43. package/dist/lower/lower.d.cts +8 -1
  44. package/dist/lower/lower.d.ts +8 -1
  45. package/dist/lower/lower.js +142 -74
  46. package/dist/lower/table.cjs +3 -2
  47. package/dist/lower/table.js +3 -2
  48. package/dist/options/options.d.cts +1 -1
  49. package/dist/options/options.d.ts +1 -1
  50. package/dist/read.cjs +45 -9
  51. package/dist/read.d.cts +1 -1
  52. package/dist/read.d.ts +1 -1
  53. package/dist/read.js +46 -10
  54. package/dist/shared/list-id.cjs +6 -0
  55. package/dist/shared/list-id.d.cts +2 -1
  56. package/dist/shared/list-id.d.ts +2 -1
  57. package/dist/shared/list-id.js +6 -1
  58. package/dist/write.cjs +31 -4
  59. package/dist/write.js +31 -4
  60. package/package.json +2 -2
  61. package/dist/link-Dv4kxVjk.d.cts +0 -18
  62. package/dist/link-Dv4kxVjk.d.ts +0 -18
@@ -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 MarkdownUnsupportedDocumentKindError, f as MarkdownWriteError, i as MarkdownDiagnosticSink, l as MarkdownParseError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, p as NOOP_MARKDOWN_DIAGNOSTIC_SINK, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownUnbalancedConstructMarkersError } from "./diagnostics-BWK1iGy7.cjs";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "./diagnostics-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 MarkdownUnsupportedDocumentKindError, f as MarkdownWriteError, i as MarkdownDiagnosticSink, l as MarkdownParseError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, p as NOOP_MARKDOWN_DIAGNOSTIC_SINK, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownUnbalancedConstructMarkersError } from "./diagnostics-BWK1iGy7.js";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownNestingLimitExceededError, d as MarkdownUnbalancedConstructMarkersError, f as MarkdownUnsupportedDocumentKindError, i as MarkdownDiagnosticSink, m as NOOP_MARKDOWN_DIAGNOSTIC_SINK, n as MarkdownDiagnosticCodes, o as MarkdownInvalidRunConstructExtentError, p as MarkdownWriteError, r as MarkdownDiagnosticSeverity, s as MarkdownInvalidUtf8Error, t as MarkdownDiagnostic, u as MarkdownParseError } from "./diagnostics-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 };
@@ -1,2 +1,2 @@
1
- import { n as parseInlines, t as InlineParseOptions } from "../inline-CXVQWQnW.cjs";
1
+ import { n as parseInlines, t as InlineParseOptions } from "../inline-CoS1JzxI.cjs";
2
2
  export { InlineParseOptions, parseInlines };
@@ -1,2 +1,2 @@
1
- import { n as parseInlines, t as InlineParseOptions } from "../inline-B_V7bs5j.js";
1
+ import { n as parseInlines, t as InlineParseOptions } from "../inline-OGXVE6hB.js";
2
2
  export { InlineParseOptions, parseInlines };
@@ -1,2 +1,18 @@
1
- import { a as matchLinkLabel, c as parseLinkTitle, i as isBlankRemainderOfLine, l as skipInlineWhitespace, n as LinkReferenceMap, o as normalizeLinkLabel, r as ParsedSpan, s as parseLinkDestination, t as LinkReferenceDefinition } from "../link-Dv4kxVjk.cjs";
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,2 +1,18 @@
1
- import { a as matchLinkLabel, c as parseLinkTitle, i as isBlankRemainderOfLine, l as skipInlineWhitespace, n as LinkReferenceMap, o as normalizeLinkLabel, r as ParsedSpan, s as parseLinkDestination, t as LinkReferenceDefinition } from "../link-Dv4kxVjk.js";
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 { n as LinkReferenceMap } from "./link-Dv4kxVjk.cjs";
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 { n as LinkReferenceMap } from "./link-Dv4kxVjk.js";
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-BWK1iGy7.cjs";
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-BWK1iGy7.js";
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
@@ -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
- return node.children.flatMap((child) => lowerInlineNode(child, childStyle, context));
25
+ lowerNodesInto(node.children, childStyle, context, runs, extents);
26
26
  }
27
- function lowerInlineNode(node, style, context) {
27
+ function lowerInlineNodeInto(node, style, context, runs, extents) {
28
28
  switch (node.type) {
29
- case "text": return node.value.length === 0 ? [] : [buildRun(node.value, style)];
30
- case "entity": return node.value.length === 0 ? [] : [buildRun(node.value, style)];
31
- case "softBreak": return [buildRun(" ", style)];
32
- case "hardBreak": return [buildRun("\n", style)];
33
- case "codeSpan": return [buildRun(node.literal, style, require_shared_style_constants.MONOSPACE_FONT_FAMILY)];
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
- return node.literal.length === 0 ? [] : [buildRun(node.literal, style)];
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
- return [buildRun(node.literal, style, require_shared_style_constants.MATH_INLINE_FONT_MARKER)];
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
- return [buildRun(`[^${node.label}]`, style, require_shared_style_constants.FOOTNOTE_REFERENCE_FONT_MARKER)];
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
- return [buildRun(node.destination, {
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 runs = node.children.flatMap((child) => lowerInlineNode(child, childStyle, context));
81
- return runs.length > 0 ? runs : [buildRun("", childStyle)];
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
- return [buildRun(node.alt, {
118
+ runs.push(buildRun(node.alt, {
90
119
  ...style,
91
120
  hyperlink: node.destination
92
- })];
93
- case "emphasis": return lowerNestedEmphasisLike("italic", node, style, context);
94
- case "strong": return lowerNestedEmphasisLike("bold", node, style, context);
95
- case "strikethrough": return lowerNestedEmphasisLike("strike", node, style, context);
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
- return nodes.flatMap((node) => lowerInlineNode(node, {}, context));
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;
@@ -1,19 +1,16 @@
1
1
  import { v as MarkdownInlineNode } from "../ast-8XCbjRQT.cjs";
2
- import { i as MarkdownDiagnosticSink } from "../diagnostics-BWK1iGy7.cjs";
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 RunStyle {
10
- readonly bold?: boolean;
11
- readonly italic?: boolean;
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 lowerInlineNode(node: MarkdownInlineNode, style: RunStyle, context: InlineLowerContext): ContentRun[];
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, lowerCodeBlockRun, lowerInlineNode, lowerInlineNodes };
16
+ export { InlineLowerContext, InlineLowerResult, lowerCodeBlockRun, lowerInlineNodes };
@@ -1,19 +1,16 @@
1
1
  import { v as MarkdownInlineNode } from "../ast-8XCbjRQT.js";
2
- import { i as MarkdownDiagnosticSink } from "../diagnostics-BWK1iGy7.js";
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 RunStyle {
10
- readonly bold?: boolean;
11
- readonly italic?: boolean;
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 lowerInlineNode(node: MarkdownInlineNode, style: RunStyle, context: InlineLowerContext): ContentRun[];
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, lowerCodeBlockRun, lowerInlineNode, lowerInlineNodes };
16
+ export { InlineLowerContext, InlineLowerResult, lowerCodeBlockRun, lowerInlineNodes };
@@ -11,7 +11,7 @@ function buildRun(text, style, fontFamily) {
11
11
  ...fontFamily !== void 0 ? { fontFamily } : {}
12
12
  };
13
13
  }
14
- function lowerNestedEmphasisLike(kind, node, style, context) {
14
+ function lowerNestedEmphasisLike(kind, node, style, context, runs, extents) {
15
15
  if (style[kind] === true) context.sink({
16
16
  code: MarkdownDiagnosticCodes.NESTED_EMPHASIS_FLATTENED,
17
17
  severity: "info",
@@ -21,15 +21,25 @@ function lowerNestedEmphasisLike(kind, node, style, context) {
21
21
  ...style,
22
22
  [kind]: true
23
23
  };
24
- return node.children.flatMap((child) => lowerInlineNode(child, childStyle, context));
24
+ lowerNodesInto(node.children, childStyle, context, runs, extents);
25
25
  }
26
- function lowerInlineNode(node, style, context) {
26
+ function lowerInlineNodeInto(node, style, context, runs, extents) {
27
27
  switch (node.type) {
28
- case "text": return node.value.length === 0 ? [] : [buildRun(node.value, style)];
29
- case "entity": return node.value.length === 0 ? [] : [buildRun(node.value, style)];
30
- case "softBreak": return [buildRun(" ", style)];
31
- case "hardBreak": return [buildRun("\n", style)];
32
- case "codeSpan": return [buildRun(node.literal, style, MONOSPACE_FONT_FAMILY)];
28
+ case "text":
29
+ if (node.value.length > 0) runs.push(buildRun(node.value, style));
30
+ return;
31
+ case "entity":
32
+ if (node.value.length > 0) runs.push(buildRun(node.value, style));
33
+ return;
34
+ case "softBreak":
35
+ runs.push(buildRun(" ", style));
36
+ return;
37
+ case "hardBreak":
38
+ runs.push(buildRun("\n", style));
39
+ return;
40
+ case "codeSpan":
41
+ runs.push(buildRun(node.literal, style, MONOSPACE_FONT_FAMILY));
42
+ return;
33
43
  case "rawHtml":
34
44
  if (context.rawHtml === "drop") {
35
45
  context.sink({
@@ -37,47 +47,66 @@ function lowerInlineNode(node, style, context) {
37
47
  severity: "info",
38
48
  message: "inline raw HTML was dropped per the rawHtml: \"drop\" option"
39
49
  });
40
- return [];
50
+ return;
41
51
  }
42
52
  context.sink({
43
53
  code: MarkdownDiagnosticCodes.RAW_HTML_PRESERVED_AS_TEXT,
44
54
  severity: "info",
45
- message: "inline raw HTML was preserved as literal text; it will not be rendered as HTML by any consumer of the resulting ContentDocument"
55
+ 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"
46
56
  });
47
- return node.literal.length === 0 ? [] : [buildRun(node.literal, style)];
57
+ if (node.literal.length > 0) runs.push({
58
+ ...buildRun(node.literal, style),
59
+ source: {
60
+ format: "markdown",
61
+ xml: node.literal
62
+ }
63
+ });
64
+ return;
48
65
  case "mathInline":
49
66
  context.sink({
50
67
  code: MarkdownDiagnosticCodes.MATH_INLINE_PRESERVED_AS_TEXT,
51
68
  severity: "info",
52
69
  message: "inline math (\\( \\)) was preserved as literal raw LaTeX text; it is not parsed as LaTeX or converted to MathML by this package"
53
70
  });
54
- return [buildRun(node.literal, style, MATH_INLINE_FONT_MARKER)];
71
+ runs.push(buildRun(node.literal, style, MATH_INLINE_FONT_MARKER));
72
+ return;
55
73
  case "footnoteReference":
56
74
  context.sink({
57
75
  code: MarkdownDiagnosticCodes.FOOTNOTE_REFERENCE_PRESERVED_AS_TEXT,
58
76
  severity: "info",
59
77
  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`
60
78
  });
61
- return [buildRun(`[^${node.label}]`, style, FOOTNOTE_REFERENCE_FONT_MARKER)];
79
+ runs.push(buildRun(`[^${node.label}]`, style, FOOTNOTE_REFERENCE_FONT_MARKER));
80
+ return;
62
81
  case "autolink": {
63
82
  const destination = node.email ? `mailto:${node.destination}` : node.destination;
64
- return [buildRun(node.destination, {
83
+ runs.push(buildRun(node.destination, {
65
84
  ...style,
66
85
  hyperlink: destination
67
- })];
86
+ }));
87
+ return;
68
88
  }
69
89
  case "link": {
70
- if (node.title !== void 0) context.sink({
71
- code: MarkdownDiagnosticCodes.LINK_TITLE_DROPPED,
72
- severity: "info",
73
- message: `link title "${node.title}" has no ContentRun equivalent and was dropped`
74
- });
75
90
  const childStyle = {
76
91
  ...style,
77
92
  hyperlink: node.destination
78
93
  };
79
- const runs = node.children.flatMap((child) => lowerInlineNode(child, childStyle, context));
80
- return runs.length > 0 ? runs : [buildRun("", childStyle)];
94
+ const startRun = runs.length;
95
+ lowerNodesInto(node.children, childStyle, context, runs, extents);
96
+ if (runs.length === startRun) runs.push(buildRun("", childStyle));
97
+ if (node.title !== void 0) extents.push({
98
+ descriptor: {
99
+ kind: "link",
100
+ target: {
101
+ kind: "external",
102
+ uri: node.destination
103
+ },
104
+ title: node.title
105
+ },
106
+ startRun,
107
+ endRun: runs.length
108
+ });
109
+ return;
81
110
  }
82
111
  case "image":
83
112
  if (node.title !== void 0) context.sink({
@@ -85,17 +114,33 @@ function lowerInlineNode(node, style, context) {
85
114
  severity: "info",
86
115
  message: `image title "${node.title}" has no ContentRun equivalent and was dropped`
87
116
  });
88
- return [buildRun(node.alt, {
117
+ runs.push(buildRun(node.alt, {
89
118
  ...style,
90
119
  hyperlink: node.destination
91
- })];
92
- case "emphasis": return lowerNestedEmphasisLike("italic", node, style, context);
93
- case "strong": return lowerNestedEmphasisLike("bold", node, style, context);
94
- case "strikethrough": return lowerNestedEmphasisLike("strike", node, style, context);
120
+ }));
121
+ return;
122
+ case "emphasis":
123
+ lowerNestedEmphasisLike("italic", node, style, context, runs, extents);
124
+ return;
125
+ case "strong":
126
+ lowerNestedEmphasisLike("bold", node, style, context, runs, extents);
127
+ return;
128
+ case "strikethrough":
129
+ lowerNestedEmphasisLike("strike", node, style, context, runs, extents);
130
+ return;
95
131
  }
96
132
  }
133
+ function lowerNodesInto(nodes, style, context, runs, extents) {
134
+ for (const node of nodes) lowerInlineNodeInto(node, style, context, runs, extents);
135
+ }
97
136
  function lowerInlineNodes(nodes, context) {
98
- return nodes.flatMap((node) => lowerInlineNode(node, {}, context));
137
+ const runs = [];
138
+ const extents = [];
139
+ lowerNodesInto(nodes, {}, context, runs, extents);
140
+ return {
141
+ runs,
142
+ linkTitleExtents: extents
143
+ };
99
144
  }
100
145
  function lowerCodeBlockRun(literal) {
101
146
  return {
@@ -104,4 +149,4 @@ function lowerCodeBlockRun(literal) {
104
149
  };
105
150
  }
106
151
  //#endregion
107
- export { lowerCodeBlockRun, lowerInlineNode, lowerInlineNodes };
152
+ export { lowerCodeBlockRun, lowerInlineNodes };