markdown-codec 1.3.31 → 1.4.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.
Files changed (71) hide show
  1. package/dist/ast/ast.cjs +2 -1
  2. package/dist/ast/ast.d.cts +2 -2
  3. package/dist/ast/ast.d.ts +2 -2
  4. package/dist/ast/ast.js +2 -1
  5. package/dist/{ast-BXYwy08e.d.cts → ast-DbjiuYr8.d.cts} +13 -3
  6. package/dist/{ast-BXYwy08e.d.ts → ast-DbjiuYr8.d.ts} +13 -3
  7. package/dist/block/block.cjs +44 -4
  8. package/dist/block/block.d.cts +3 -3
  9. package/dist/block/block.d.ts +3 -3
  10. package/dist/block/block.js +44 -4
  11. package/dist/block/definitions.d.cts +1 -1
  12. package/dist/block/definitions.d.ts +1 -1
  13. package/dist/block/node.cjs +1 -1
  14. package/dist/block/node.d.cts +2 -2
  15. package/dist/block/node.d.ts +2 -2
  16. package/dist/block/node.js +1 -1
  17. package/dist/block/table.d.cts +1 -1
  18. package/dist/block/table.d.ts +1 -1
  19. package/dist/codec.d.cts +68 -5
  20. package/dist/codec.d.ts +68 -5
  21. package/dist/diagnostics/diagnostics.cjs +3 -0
  22. package/dist/diagnostics/diagnostics.d.cts +1 -1
  23. package/dist/diagnostics/diagnostics.d.ts +1 -1
  24. package/dist/diagnostics/diagnostics.js +3 -0
  25. package/dist/{diagnostics-DmuWc7d8.d.cts → diagnostics-B72W0P_E.d.cts} +3 -0
  26. package/dist/{diagnostics-DmuWc7d8.d.ts → diagnostics-B72W0P_E.d.ts} +3 -0
  27. package/dist/emit/emit.cjs +3 -1
  28. package/dist/emit/emit.js +4 -2
  29. package/dist/emit/inline.cjs +2 -3
  30. package/dist/emit/inline.d.cts +1 -1
  31. package/dist/emit/inline.d.ts +1 -1
  32. package/dist/emit/inline.js +2 -3
  33. package/dist/emit/table.d.cts +1 -1
  34. package/dist/emit/table.d.ts +1 -1
  35. package/dist/html/render.cjs +6 -0
  36. package/dist/html/render.d.cts +1 -1
  37. package/dist/html/render.d.ts +1 -1
  38. package/dist/html/render.js +6 -0
  39. package/dist/index.d.cts +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/inline/inline.cjs +16 -0
  42. package/dist/inline/inline.d.cts +1 -1
  43. package/dist/inline/inline.d.ts +1 -1
  44. package/dist/inline/inline.js +16 -0
  45. package/dist/inline/math.cjs +10 -0
  46. package/dist/inline/math.d.cts +4 -0
  47. package/dist/inline/math.d.ts +4 -0
  48. package/dist/inline/math.js +9 -0
  49. package/dist/inline/node.d.cts +1 -1
  50. package/dist/inline/node.d.ts +1 -1
  51. package/dist/{inline-B50cM6cn.d.ts → inline-TuBQ2TUr.d.ts} +1 -1
  52. package/dist/{inline-C9YEGDV5.d.cts → inline-uVHJ5xzT.d.cts} +1 -1
  53. package/dist/lower/front-matter.d.cts +1 -1
  54. package/dist/lower/front-matter.d.ts +1 -1
  55. package/dist/lower/inline.cjs +7 -0
  56. package/dist/lower/inline.d.cts +2 -2
  57. package/dist/lower/inline.d.ts +2 -2
  58. package/dist/lower/inline.js +8 -1
  59. package/dist/lower/lower.cjs +14 -0
  60. package/dist/lower/lower.js +15 -1
  61. package/dist/lower/table.d.cts +1 -1
  62. package/dist/lower/table.d.ts +1 -1
  63. package/dist/options/options.d.cts +1 -1
  64. package/dist/options/options.d.ts +1 -1
  65. package/dist/read.d.cts +1 -1
  66. package/dist/read.d.ts +1 -1
  67. package/dist/shared/style-constants.cjs +4 -0
  68. package/dist/shared/style-constants.d.cts +3 -1
  69. package/dist/shared/style-constants.d.ts +3 -1
  70. package/dist/shared/style-constants.js +3 -1
  71. package/package.json +2 -2
package/dist/codec.d.ts CHANGED
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  declare const MarkdownBytesSchema: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
4
4
  declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodDiscriminatedUnion<[z.ZodObject<{
5
5
  kind: z.ZodLiteral<"wordprocessing">;
6
- formatVersion: z.ZodLiteral<2>;
6
+ formatVersion: z.ZodLiteral<3>;
7
7
  metadata: z.ZodObject<{
8
8
  title: z.ZodOptional<z.ZodString>;
9
9
  author: z.ZodOptional<z.ZodString>;
@@ -29,7 +29,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
29
29
  }, z.core.$strip>>;
30
30
  }, z.core.$strip>, z.ZodObject<{
31
31
  kind: z.ZodLiteral<"presentation">;
32
- formatVersion: z.ZodLiteral<2>;
32
+ formatVersion: z.ZodLiteral<3>;
33
33
  metadata: z.ZodObject<{
34
34
  title: z.ZodOptional<z.ZodString>;
35
35
  author: z.ZodOptional<z.ZodString>;
@@ -62,13 +62,20 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
62
62
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
63
63
  paintOrder: z.ZodOptional<z.ZodNumber>;
64
64
  sourcePath: z.ZodOptional<z.ZodString>;
65
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
66
+ pageIndex: z.ZodNumber;
67
+ xPt: z.ZodNumber;
68
+ yPt: z.ZodNumber;
69
+ widthPt: z.ZodNumber;
70
+ heightPt: z.ZodNumber;
71
+ }, z.core.$strip>>>;
65
72
  blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
66
73
  }, z.core.$strip>>;
67
74
  notes: z.ZodString;
68
75
  }, z.core.$strip>>;
69
76
  }, z.core.$strip>, z.ZodObject<{
70
77
  kind: z.ZodLiteral<"spreadsheet">;
71
- formatVersion: z.ZodLiteral<2>;
78
+ formatVersion: z.ZodLiteral<3>;
72
79
  metadata: z.ZodObject<{
73
80
  title: z.ZodOptional<z.ZodString>;
74
81
  author: z.ZodOptional<z.ZodString>;
@@ -135,6 +142,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
135
142
  }, z.core.$strip>>;
136
143
  hyperlink: z.ZodOptional<z.ZodString>;
137
144
  sourcePath: z.ZodOptional<z.ZodString>;
145
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
146
+ pageIndex: z.ZodNumber;
147
+ xPt: z.ZodNumber;
148
+ yPt: z.ZodNumber;
149
+ widthPt: z.ZodNumber;
150
+ heightPt: z.ZodNumber;
151
+ }, z.core.$strip>>>;
138
152
  }, z.core.$strip>>>;
139
153
  colSpan: z.ZodOptional<z.ZodNumber>;
140
154
  rowSpan: z.ZodOptional<z.ZodNumber>;
@@ -213,6 +227,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
213
227
  middle: "middle";
214
228
  }>>;
215
229
  sourcePath: z.ZodOptional<z.ZodString>;
230
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
231
+ pageIndex: z.ZodNumber;
232
+ xPt: z.ZodNumber;
233
+ yPt: z.ZodNumber;
234
+ widthPt: z.ZodNumber;
235
+ heightPt: z.ZodNumber;
236
+ }, z.core.$strip>>>;
216
237
  }, z.core.$strip>>;
217
238
  columns: z.ZodArray<z.ZodObject<{
218
239
  index: z.ZodNumber;
@@ -235,6 +256,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
235
256
  heightPt: z.ZodNumber;
236
257
  altText: z.ZodOptional<z.ZodString>;
237
258
  sourcePath: z.ZodOptional<z.ZodString>;
259
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
260
+ pageIndex: z.ZodNumber;
261
+ xPt: z.ZodNumber;
262
+ yPt: z.ZodNumber;
263
+ widthPt: z.ZodNumber;
264
+ heightPt: z.ZodNumber;
265
+ }, z.core.$strip>>>;
238
266
  anchorRow: z.ZodNumber;
239
267
  anchorColumn: z.ZodNumber;
240
268
  offsetXPt: z.ZodNumber;
@@ -285,7 +313,7 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
285
313
  }, z.core.$strip>>;
286
314
  }, z.core.$strip>, z.ZodObject<{
287
315
  kind: z.ZodLiteral<"drawing">;
288
- formatVersion: z.ZodLiteral<2>;
316
+ formatVersion: z.ZodLiteral<3>;
289
317
  metadata: z.ZodObject<{
290
318
  title: z.ZodOptional<z.ZodString>;
291
319
  author: z.ZodOptional<z.ZodString>;
@@ -318,6 +346,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
318
346
  lineSpacingReduction: z.ZodOptional<z.ZodNumber>;
319
347
  paintOrder: z.ZodOptional<z.ZodNumber>;
320
348
  sourcePath: z.ZodOptional<z.ZodString>;
349
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
350
+ pageIndex: z.ZodNumber;
351
+ xPt: z.ZodNumber;
352
+ yPt: z.ZodNumber;
353
+ widthPt: z.ZodNumber;
354
+ heightPt: z.ZodNumber;
355
+ }, z.core.$strip>>>;
321
356
  blocks: z.ZodArray<z.ZodCustom<import("document-schema.js").ContentBlock, import("document-schema.js").ContentBlock>>;
322
357
  }, z.core.$strip>>;
323
358
  vectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -350,6 +385,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
350
385
  }, z.core.$strip>>;
351
386
  paintOrder: z.ZodOptional<z.ZodNumber>;
352
387
  sourcePath: z.ZodOptional<z.ZodString>;
388
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
389
+ pageIndex: z.ZodNumber;
390
+ xPt: z.ZodNumber;
391
+ yPt: z.ZodNumber;
392
+ widthPt: z.ZodNumber;
393
+ heightPt: z.ZodNumber;
394
+ }, z.core.$strip>>>;
353
395
  }, z.core.$strip>, z.ZodObject<{
354
396
  kind: z.ZodLiteral<"ellipse">;
355
397
  frame: z.ZodObject<{
@@ -380,6 +422,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
380
422
  }, z.core.$strip>>;
381
423
  paintOrder: z.ZodOptional<z.ZodNumber>;
382
424
  sourcePath: z.ZodOptional<z.ZodString>;
425
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
426
+ pageIndex: z.ZodNumber;
427
+ xPt: z.ZodNumber;
428
+ yPt: z.ZodNumber;
429
+ widthPt: z.ZodNumber;
430
+ heightPt: z.ZodNumber;
431
+ }, z.core.$strip>>>;
383
432
  }, z.core.$strip>, z.ZodObject<{
384
433
  kind: z.ZodLiteral<"line">;
385
434
  from: z.ZodObject<{
@@ -406,6 +455,13 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
406
455
  }, z.core.$strip>;
407
456
  paintOrder: z.ZodOptional<z.ZodNumber>;
408
457
  sourcePath: z.ZodOptional<z.ZodString>;
458
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
459
+ pageIndex: z.ZodNumber;
460
+ xPt: z.ZodNumber;
461
+ yPt: z.ZodNumber;
462
+ widthPt: z.ZodNumber;
463
+ heightPt: z.ZodNumber;
464
+ }, z.core.$strip>>>;
409
465
  }, z.core.$strip>, z.ZodObject<{
410
466
  kind: z.ZodLiteral<"path">;
411
467
  frame: z.ZodObject<{
@@ -468,11 +524,18 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
468
524
  }, z.core.$strip>>;
469
525
  paintOrder: z.ZodOptional<z.ZodNumber>;
470
526
  sourcePath: z.ZodOptional<z.ZodString>;
527
+ frames: z.ZodOptional<z.ZodArray<z.ZodObject<{
528
+ pageIndex: z.ZodNumber;
529
+ xPt: z.ZodNumber;
530
+ yPt: z.ZodNumber;
531
+ widthPt: z.ZodNumber;
532
+ heightPt: z.ZodNumber;
533
+ }, z.core.$strip>>>;
471
534
  }, z.core.$strip>], "kind">>;
472
535
  }, z.core.$strip>>;
473
536
  }, z.core.$strip>, z.ZodObject<{
474
537
  kind: z.ZodLiteral<"formula">;
475
- formatVersion: z.ZodLiteral<2>;
538
+ formatVersion: z.ZodLiteral<3>;
476
539
  metadata: z.ZodObject<{
477
540
  title: z.ZodOptional<z.ZodString>;
478
541
  author: z.ZodOptional<z.ZodString>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const NOOP_MARKDOWN_DIAGNOSTIC_SINK = () => {};
4
4
  const MarkdownDiagnosticCodes = {
5
5
  UNCLOSED_FENCE: "md/unclosed-fence",
6
+ UNCLOSED_MATH_BLOCK: "md/unclosed-math-block",
6
7
  UNTERMINATED_HTML_BLOCK: "md/unterminated-html-block",
7
8
  TABLE_CELL_COUNT_MISMATCH: "md/table-cell-count-mismatch",
8
9
  DUPLICATE_LINK_REFERENCE: "md/duplicate-link-reference",
@@ -17,6 +18,8 @@ const MarkdownDiagnosticCodes = {
17
18
  IMAGE_UNRESOLVED: "md/image-unresolved",
18
19
  RAW_HTML_PRESERVED_AS_TEXT: "md/raw-html-preserved-as-text",
19
20
  RAW_HTML_DROPPED: "md/raw-html-dropped",
21
+ MATH_BLOCK_PRESERVED_AS_TEXT: "md/math-block-preserved-as-text",
22
+ MATH_INLINE_PRESERVED_AS_TEXT: "md/math-inline-preserved-as-text",
20
23
  FRONT_MATTER_KEY_UNMAPPED: "md/front-matter-key-unmapped",
21
24
  HEADING_LEVEL_CLAMPED: "md/heading-level-clamped",
22
25
  ADJACENT_LINKS_MERGED: "md/adjacent-links-merged",
@@ -1,2 +1,2 @@
1
- import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "../diagnostics-DmuWc7d8.cjs";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "../diagnostics-B72W0P_E.cjs";
2
2
  export { MarkdownDiagnostic, MarkdownDiagnosticCodes, MarkdownDiagnosticSeverity, MarkdownDiagnosticSink, MarkdownInputTooLargeError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownParseError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK };
@@ -1,2 +1,2 @@
1
- import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "../diagnostics-DmuWc7d8.js";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "../diagnostics-B72W0P_E.js";
2
2
  export { MarkdownDiagnostic, MarkdownDiagnosticCodes, MarkdownDiagnosticSeverity, MarkdownDiagnosticSink, MarkdownInputTooLargeError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownParseError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK };
@@ -2,6 +2,7 @@
2
2
  const NOOP_MARKDOWN_DIAGNOSTIC_SINK = () => {};
3
3
  const MarkdownDiagnosticCodes = {
4
4
  UNCLOSED_FENCE: "md/unclosed-fence",
5
+ UNCLOSED_MATH_BLOCK: "md/unclosed-math-block",
5
6
  UNTERMINATED_HTML_BLOCK: "md/unterminated-html-block",
6
7
  TABLE_CELL_COUNT_MISMATCH: "md/table-cell-count-mismatch",
7
8
  DUPLICATE_LINK_REFERENCE: "md/duplicate-link-reference",
@@ -16,6 +17,8 @@ const MarkdownDiagnosticCodes = {
16
17
  IMAGE_UNRESOLVED: "md/image-unresolved",
17
18
  RAW_HTML_PRESERVED_AS_TEXT: "md/raw-html-preserved-as-text",
18
19
  RAW_HTML_DROPPED: "md/raw-html-dropped",
20
+ MATH_BLOCK_PRESERVED_AS_TEXT: "md/math-block-preserved-as-text",
21
+ MATH_INLINE_PRESERVED_AS_TEXT: "md/math-inline-preserved-as-text",
19
22
  FRONT_MATTER_KEY_UNMAPPED: "md/front-matter-key-unmapped",
20
23
  HEADING_LEVEL_CLAMPED: "md/heading-level-clamped",
21
24
  ADJACENT_LINKS_MERGED: "md/adjacent-links-merged",
@@ -10,6 +10,7 @@ type MarkdownDiagnosticSink = (diagnostic: MarkdownDiagnostic) => void;
10
10
  declare const NOOP_MARKDOWN_DIAGNOSTIC_SINK: MarkdownDiagnosticSink;
11
11
  declare const MarkdownDiagnosticCodes: {
12
12
  readonly UNCLOSED_FENCE: "md/unclosed-fence";
13
+ readonly UNCLOSED_MATH_BLOCK: "md/unclosed-math-block";
13
14
  readonly UNTERMINATED_HTML_BLOCK: "md/unterminated-html-block";
14
15
  readonly TABLE_CELL_COUNT_MISMATCH: "md/table-cell-count-mismatch";
15
16
  readonly DUPLICATE_LINK_REFERENCE: "md/duplicate-link-reference";
@@ -24,6 +25,8 @@ declare const MarkdownDiagnosticCodes: {
24
25
  readonly IMAGE_UNRESOLVED: "md/image-unresolved";
25
26
  readonly RAW_HTML_PRESERVED_AS_TEXT: "md/raw-html-preserved-as-text";
26
27
  readonly RAW_HTML_DROPPED: "md/raw-html-dropped";
28
+ readonly MATH_BLOCK_PRESERVED_AS_TEXT: "md/math-block-preserved-as-text";
29
+ readonly MATH_INLINE_PRESERVED_AS_TEXT: "md/math-inline-preserved-as-text";
27
30
  readonly FRONT_MATTER_KEY_UNMAPPED: "md/front-matter-key-unmapped";
28
31
  readonly HEADING_LEVEL_CLAMPED: "md/heading-level-clamped";
29
32
  readonly ADJACENT_LINKS_MERGED: "md/adjacent-links-merged";
@@ -10,6 +10,7 @@ type MarkdownDiagnosticSink = (diagnostic: MarkdownDiagnostic) => void;
10
10
  declare const NOOP_MARKDOWN_DIAGNOSTIC_SINK: MarkdownDiagnosticSink;
11
11
  declare const MarkdownDiagnosticCodes: {
12
12
  readonly UNCLOSED_FENCE: "md/unclosed-fence";
13
+ readonly UNCLOSED_MATH_BLOCK: "md/unclosed-math-block";
13
14
  readonly UNTERMINATED_HTML_BLOCK: "md/unterminated-html-block";
14
15
  readonly TABLE_CELL_COUNT_MISMATCH: "md/table-cell-count-mismatch";
15
16
  readonly DUPLICATE_LINK_REFERENCE: "md/duplicate-link-reference";
@@ -24,6 +25,8 @@ declare const MarkdownDiagnosticCodes: {
24
25
  readonly IMAGE_UNRESOLVED: "md/image-unresolved";
25
26
  readonly RAW_HTML_PRESERVED_AS_TEXT: "md/raw-html-preserved-as-text";
26
27
  readonly RAW_HTML_DROPPED: "md/raw-html-dropped";
28
+ readonly MATH_BLOCK_PRESERVED_AS_TEXT: "md/math-block-preserved-as-text";
29
+ readonly MATH_INLINE_PRESERVED_AS_TEXT: "md/math-inline-preserved-as-text";
27
30
  readonly FRONT_MATTER_KEY_UNMAPPED: "md/front-matter-key-unmapped";
28
31
  readonly HEADING_LEVEL_CLAMPED: "md/heading-level-clamped";
29
32
  readonly ADJACENT_LINKS_MERGED: "md/adjacent-links-merged";
@@ -34,7 +34,8 @@ const QUOTABLE_STYLE_IDS = /* @__PURE__ */ new Set([
34
34
  require_shared_style_constants.QUOTE_STYLE_ID,
35
35
  require_shared_style_constants.CODE_BLOCK_STYLE_ID,
36
36
  require_shared_style_constants.HORIZONTAL_RULE_STYLE_ID,
37
- require_shared_style_constants.HTML_PREFORMATTED_STYLE_ID
37
+ require_shared_style_constants.HTML_PREFORMATTED_STYLE_ID,
38
+ require_shared_style_constants.MATH_BLOCK_STYLE_ID
38
39
  ]);
39
40
  function isQuotableStyle(styleId) {
40
41
  if (styleId === void 0) return false;
@@ -52,6 +53,7 @@ function renderParagraphBody(paragraph, context) {
52
53
  return literal.length === 0 ? `${fence}\n${fence}` : `${fence}\n${literal}\n${fence}`;
53
54
  }
54
55
  if (paragraph.styleId === "HTMLPreformatted") return paragraph.runs.map((run) => run.text).join("");
56
+ if (paragraph.styleId === "MathBlock") return `$$\n${paragraph.runs.map((run) => run.text).join("")}\n$$`;
55
57
  const headingLevel = paragraph.styleId === void 0 ? void 0 : require_shared_style_constants.parseHeadingStyleId(paragraph.styleId);
56
58
  if (headingLevel !== void 0) {
57
59
  let level = headingLevel;
package/dist/emit/emit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "../defaults/defaults.js";
2
2
  import { MarkdownDiagnosticCodes, MarkdownUnsupportedDocumentKindError, NOOP_MARKDOWN_DIAGNOSTIC_SINK } from "../diagnostics/diagnostics.js";
3
3
  import { parseListNumId } from "../shared/list-id.js";
4
- import { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, QUOTE_STYLE_ID, parseHeadingStyleId } from "../shared/style-constants.js";
4
+ import { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, QUOTE_STYLE_ID, parseHeadingStyleId } from "../shared/style-constants.js";
5
5
  import { emitFrontMatter } from "./front-matter.js";
6
6
  import { emitRuns } from "./inline.js";
7
7
  import { emitImage } from "./image.js";
@@ -33,7 +33,8 @@ const QUOTABLE_STYLE_IDS = /* @__PURE__ */ new Set([
33
33
  QUOTE_STYLE_ID,
34
34
  CODE_BLOCK_STYLE_ID,
35
35
  HORIZONTAL_RULE_STYLE_ID,
36
- HTML_PREFORMATTED_STYLE_ID
36
+ HTML_PREFORMATTED_STYLE_ID,
37
+ MATH_BLOCK_STYLE_ID
37
38
  ]);
38
39
  function isQuotableStyle(styleId) {
39
40
  if (styleId === void 0) return false;
@@ -51,6 +52,7 @@ function renderParagraphBody(paragraph, context) {
51
52
  return literal.length === 0 ? `${fence}\n${fence}` : `${fence}\n${literal}\n${fence}`;
52
53
  }
53
54
  if (paragraph.styleId === "HTMLPreformatted") return paragraph.runs.map((run) => run.text).join("");
55
+ if (paragraph.styleId === "MathBlock") return `$$\n${paragraph.runs.map((run) => run.text).join("")}\n$$`;
54
56
  const headingLevel = paragraph.styleId === void 0 ? void 0 : parseHeadingStyleId(paragraph.styleId);
55
57
  if (headingLevel !== void 0) {
56
58
  let level = headingLevel;
@@ -11,8 +11,6 @@ const ESCAPE_CHARS = /* @__PURE__ */ new Set([
11
11
  "%",
12
12
  "&",
13
13
  "'",
14
- "(",
15
- ")",
16
14
  "*",
17
15
  "+",
18
16
  ",",
@@ -87,6 +85,7 @@ function renderLeaf(run, context) {
87
85
  });
88
86
  return renderCodeSpan(run.text);
89
87
  }
88
+ if (run.fontFamily === "Cambria Math") return `\\(${run.text}\\)`;
90
89
  return escapeMarkdownText(run.text);
91
90
  }
92
91
  const STYLE_KEYS = [
@@ -136,7 +135,7 @@ function renderNestedStyles(runs, depth, context) {
136
135
  return out;
137
136
  }
138
137
  function isPlainAutolink(run) {
139
- if (run.hyperlink === void 0 || run.hyperlink.length === 0 || run.bold === true || run.italic === true || run.strike === true || run.fontFamily === "Courier New") return false;
138
+ if (run.hyperlink === void 0 || run.hyperlink.length === 0 || run.bold === true || run.italic === true || run.strike === true || run.fontFamily === "Courier New" || run.fontFamily === "Cambria Math") return false;
140
139
  return run.text === run.hyperlink || run.hyperlink === `mailto:${run.text}`;
141
140
  }
142
141
  function escapeLinkDestination(destination) {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-DmuWc7d8.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
2
2
  import { ContentRun } from "document-schema.js";
3
3
  //#region src/emit/inline.d.ts
4
4
  interface InlineEmitContext {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-DmuWc7d8.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.js";
2
2
  import { ContentRun } from "document-schema.js";
3
3
  //#region src/emit/inline.d.ts
4
4
  interface InlineEmitContext {
@@ -10,8 +10,6 @@ const ESCAPE_CHARS = /* @__PURE__ */ new Set([
10
10
  "%",
11
11
  "&",
12
12
  "'",
13
- "(",
14
- ")",
15
13
  "*",
16
14
  "+",
17
15
  ",",
@@ -86,6 +84,7 @@ function renderLeaf(run, context) {
86
84
  });
87
85
  return renderCodeSpan(run.text);
88
86
  }
87
+ if (run.fontFamily === "Cambria Math") return `\\(${run.text}\\)`;
89
88
  return escapeMarkdownText(run.text);
90
89
  }
91
90
  const STYLE_KEYS = [
@@ -135,7 +134,7 @@ function renderNestedStyles(runs, depth, context) {
135
134
  return out;
136
135
  }
137
136
  function isPlainAutolink(run) {
138
- if (run.hyperlink === void 0 || run.hyperlink.length === 0 || run.bold === true || run.italic === true || run.strike === true || run.fontFamily === "Courier New") return false;
137
+ if (run.hyperlink === void 0 || run.hyperlink.length === 0 || run.bold === true || run.italic === true || run.strike === true || run.fontFamily === "Courier New" || run.fontFamily === "Cambria Math") return false;
139
138
  return run.text === run.hyperlink || run.hyperlink === `mailto:${run.text}`;
140
139
  }
141
140
  function escapeLinkDestination(destination) {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-DmuWc7d8.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
2
2
  import { InlineEmitContext } from "./inline.cjs";
3
3
  import { ContentTable } from "document-schema.js";
4
4
  //#region src/emit/table.d.ts
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-DmuWc7d8.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.js";
2
2
  import { InlineEmitContext } from "./inline.js";
3
3
  import { ContentTable } from "document-schema.js";
4
4
  //#region src/emit/table.d.ts
@@ -79,6 +79,7 @@ function renderInline(node) {
79
79
  case "rawHtml": return node.literal;
80
80
  case "hardBreak": return "<br />\n";
81
81
  case "softBreak": return "\n";
82
+ case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
82
83
  }
83
84
  }
84
85
  function renderInlines(nodes) {
@@ -134,6 +135,11 @@ var HtmlRenderer = class {
134
135
  case "table":
135
136
  this.renderTable(node);
136
137
  return;
138
+ case "mathBlock":
139
+ this.cr();
140
+ this.out += `$$\n${escapeHtml(node.literal)}\n$$\n`;
141
+ this.cr();
142
+ return;
137
143
  case "document":
138
144
  case "listItem":
139
145
  case "tableRow":
@@ -1,4 +1,4 @@
1
- import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-BXYwy08e.cjs";
1
+ import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-DbjiuYr8.cjs";
2
2
  //#region src/html/render.d.ts
3
3
  declare function escapeHtml(text: string): string;
4
4
  declare function escapeHref(href: string): string;
@@ -1,4 +1,4 @@
1
- import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-BXYwy08e.js";
1
+ import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-DbjiuYr8.js";
2
2
  //#region src/html/render.d.ts
3
3
  declare function escapeHtml(text: string): string;
4
4
  declare function escapeHref(href: string): string;
@@ -78,6 +78,7 @@ function renderInline(node) {
78
78
  case "rawHtml": return node.literal;
79
79
  case "hardBreak": return "<br />\n";
80
80
  case "softBreak": return "\n";
81
+ case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
81
82
  }
82
83
  }
83
84
  function renderInlines(nodes) {
@@ -133,6 +134,11 @@ var HtmlRenderer = class {
133
134
  case "table":
134
135
  this.renderTable(node);
135
136
  return;
137
+ case "mathBlock":
138
+ this.cr();
139
+ this.out += `$$\n${escapeHtml(node.literal)}\n$$\n`;
140
+ this.cr();
141
+ return;
136
142
  case "document":
137
143
  case "listItem":
138
144
  case "tableRow":
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "./diagnostics-DmuWc7d8.cjs";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "./diagnostics-B72W0P_E.cjs";
2
2
  import { MarkdownBytesSchema, markdownCodec } 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";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "./diagnostics-DmuWc7d8.js";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnsupportedDocumentKindError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownWriteError } from "./diagnostics-B72W0P_E.js";
2
2
  import { MarkdownBytesSchema, markdownCodec } 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,6 +6,7 @@ const require_inline_delimiter = require("./delimiter.cjs");
6
6
  const require_inline_node = require("./node.cjs");
7
7
  const require_inline_gfm_autolink = require("./gfm-autolink.cjs");
8
8
  const require_inline_link = require("./link.cjs");
9
+ const require_inline_math = require("./math.cjs");
9
10
  //#region src/inline/inline.ts
10
11
  const PLAIN_TEXT_PATTERN = /[^\n`[\]\\!<&*_~]+/y;
11
12
  const URI_AUTOLINK_PATTERN = /<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>]*>/y;
@@ -102,6 +103,7 @@ var InlineParser = class {
102
103
  while (this.text.charAt(this.pos) === " ") this.pos += 1;
103
104
  }
104
105
  parseBackslash() {
106
+ const backslashIndex = this.pos;
105
107
  this.pos += 1;
106
108
  const next = this.text.charAt(this.pos);
107
109
  if (next === "\n") {
@@ -109,6 +111,16 @@ var InlineParser = class {
109
111
  this.container.appendChild(new require_inline_node.InlineNode("hardBreak"));
110
112
  return;
111
113
  }
114
+ if (next === "(") {
115
+ const span = require_inline_math.matchMathInlineSpan(this.text, backslashIndex);
116
+ if (span !== void 0) {
117
+ const node = new require_inline_node.InlineNode("mathInline");
118
+ node.literal = span.slice(2, span.length - 2);
119
+ this.container.appendChild(node);
120
+ this.pos = backslashIndex + span.length;
121
+ return;
122
+ }
123
+ }
112
124
  if (require_inline_chars.isAsciiPunctuation(next)) {
113
125
  this.appendText(next);
114
126
  this.pos += 1;
@@ -442,6 +454,10 @@ function toAstNode(node) {
442
454
  raw: node.raw,
443
455
  value: node.literal
444
456
  };
457
+ case "mathInline": return {
458
+ type: "mathInline",
459
+ literal: node.literal
460
+ };
445
461
  case "container": return;
446
462
  }
447
463
  }
@@ -1,2 +1,2 @@
1
- import { n as parseInlines, t as InlineParseOptions } from "../inline-C9YEGDV5.cjs";
1
+ import { n as parseInlines, t as InlineParseOptions } from "../inline-uVHJ5xzT.cjs";
2
2
  export { InlineParseOptions, parseInlines };
@@ -1,2 +1,2 @@
1
- import { n as parseInlines, t as InlineParseOptions } from "../inline-B50cM6cn.js";
1
+ import { n as parseInlines, t as InlineParseOptions } from "../inline-TuBQ2TUr.js";
2
2
  export { InlineParseOptions, parseInlines };
@@ -5,6 +5,7 @@ import { DelimiterStack, isDelimiterChar, processEmphasis, scanDelimiterRun } fr
5
5
  import { InlineNode, createTextNode } from "./node.js";
6
6
  import { applyGfmAutolinks } from "./gfm-autolink.js";
7
7
  import { matchLinkLabel, normalizeLinkLabel, parseLinkDestination, parseLinkTitle, skipInlineWhitespace } from "./link.js";
8
+ import { matchMathInlineSpan } from "./math.js";
8
9
  //#region src/inline/inline.ts
9
10
  const PLAIN_TEXT_PATTERN = /[^\n`[\]\\!<&*_~]+/y;
10
11
  const URI_AUTOLINK_PATTERN = /<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>]*>/y;
@@ -101,6 +102,7 @@ var InlineParser = class {
101
102
  while (this.text.charAt(this.pos) === " ") this.pos += 1;
102
103
  }
103
104
  parseBackslash() {
105
+ const backslashIndex = this.pos;
104
106
  this.pos += 1;
105
107
  const next = this.text.charAt(this.pos);
106
108
  if (next === "\n") {
@@ -108,6 +110,16 @@ var InlineParser = class {
108
110
  this.container.appendChild(new InlineNode("hardBreak"));
109
111
  return;
110
112
  }
113
+ if (next === "(") {
114
+ const span = matchMathInlineSpan(this.text, backslashIndex);
115
+ if (span !== void 0) {
116
+ const node = new InlineNode("mathInline");
117
+ node.literal = span.slice(2, span.length - 2);
118
+ this.container.appendChild(node);
119
+ this.pos = backslashIndex + span.length;
120
+ return;
121
+ }
122
+ }
111
123
  if (isAsciiPunctuation(next)) {
112
124
  this.appendText(next);
113
125
  this.pos += 1;
@@ -441,6 +453,10 @@ function toAstNode(node) {
441
453
  raw: node.raw,
442
454
  value: node.literal
443
455
  };
456
+ case "mathInline": return {
457
+ type: "mathInline",
458
+ literal: node.literal
459
+ };
444
460
  case "container": return;
445
461
  }
446
462
  }
@@ -0,0 +1,10 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/inline/math.ts
3
+ function matchMathInlineSpan(text, index) {
4
+ if (text.charAt(index) !== "\\" || text.charAt(index + 1) !== "(") return;
5
+ const closeIndex = text.indexOf("\\)", index + 2);
6
+ if (closeIndex === -1) return;
7
+ return text.slice(index, closeIndex + 2);
8
+ }
9
+ //#endregion
10
+ exports.matchMathInlineSpan = matchMathInlineSpan;
@@ -0,0 +1,4 @@
1
+ //#region src/inline/math.d.ts
2
+ declare function matchMathInlineSpan(text: string, index: number): string | undefined;
3
+ //#endregion
4
+ export { matchMathInlineSpan };
@@ -0,0 +1,4 @@
1
+ //#region src/inline/math.d.ts
2
+ declare function matchMathInlineSpan(text: string, index: number): string | undefined;
3
+ //#endregion
4
+ export { matchMathInlineSpan };
@@ -0,0 +1,9 @@
1
+ //#region src/inline/math.ts
2
+ function matchMathInlineSpan(text, index) {
3
+ if (text.charAt(index) !== "\\" || text.charAt(index + 1) !== "(") return;
4
+ const closeIndex = text.indexOf("\\)", index + 2);
5
+ if (closeIndex === -1) return;
6
+ return text.slice(index, closeIndex + 2);
7
+ }
8
+ //#endregion
9
+ export { matchMathInlineSpan };
@@ -1,5 +1,5 @@
1
1
  //#region src/inline/node.d.ts
2
- type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'container';
2
+ type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'mathInline' | 'container';
3
3
  declare class InlineNode {
4
4
  readonly kind: InlineNodeKind;
5
5
  literal: string;
@@ -1,5 +1,5 @@
1
1
  //#region src/inline/node.d.ts
2
- type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'container';
2
+ type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'mathInline' | 'container';
3
3
  declare class InlineNode {
4
4
  readonly kind: InlineNodeKind;
5
5
  literal: string;
@@ -1,4 +1,4 @@
1
- import { g as MarkdownInlineNode } from "./ast-BXYwy08e.js";
1
+ import { g as MarkdownInlineNode } from "./ast-DbjiuYr8.js";
2
2
  import { n as LinkReferenceMap } from "./link-Dv4kxVjk.js";
3
3
  //#region src/inline/inline.d.ts
4
4
  interface InlineParseOptions {
@@ -1,4 +1,4 @@
1
- import { g as MarkdownInlineNode } from "./ast-BXYwy08e.cjs";
1
+ import { g as MarkdownInlineNode } from "./ast-DbjiuYr8.cjs";
2
2
  import { n as LinkReferenceMap } from "./link-Dv4kxVjk.cjs";
3
3
  //#region src/inline/inline.d.ts
4
4
  interface InlineParseOptions {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-DmuWc7d8.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
2
2
  import { LayoutMetadata } from "document-schema.js";
3
3
  //#region src/lower/front-matter.d.ts
4
4
  interface FrontMatterResult {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-DmuWc7d8.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.js";
2
2
  import { LayoutMetadata } from "document-schema.js";
3
3
  //#region src/lower/front-matter.d.ts
4
4
  interface FrontMatterResult {
@@ -46,6 +46,13 @@ function lowerInlineNode(node, style, context) {
46
46
  message: "inline raw HTML was preserved as literal text; it will not be rendered as HTML by any consumer of the resulting ContentDocument"
47
47
  });
48
48
  return node.literal.length === 0 ? [] : [buildRun(node.literal, style)];
49
+ case "mathInline":
50
+ context.sink({
51
+ code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.MATH_INLINE_PRESERVED_AS_TEXT,
52
+ severity: "info",
53
+ message: "inline math (\\( \\)) was preserved as literal raw LaTeX text; it is not parsed as LaTeX or converted to MathML by this package"
54
+ });
55
+ return [buildRun(node.literal, style, require_shared_style_constants.MATH_INLINE_FONT_MARKER)];
49
56
  case "autolink": {
50
57
  const destination = node.email ? `mailto:${node.destination}` : node.destination;
51
58
  return [buildRun(node.destination, {