markdown-codec 0.0.0 → 1.0.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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +215 -0
  3. package/dist/ast/ast.cjs +25 -0
  4. package/dist/ast/ast.d.cts +2 -0
  5. package/dist/ast/ast.d.ts +2 -0
  6. package/dist/ast/ast.js +23 -0
  7. package/dist/ast-BXYwy08e.d.cts +160 -0
  8. package/dist/ast-BXYwy08e.d.ts +160 -0
  9. package/dist/block/block.cjs +530 -0
  10. package/dist/block/block.d.cts +18 -0
  11. package/dist/block/block.d.ts +18 -0
  12. package/dist/block/block.js +529 -0
  13. package/dist/block/definitions.cjs +59 -0
  14. package/dist/block/definitions.d.cts +6 -0
  15. package/dist/block/definitions.d.ts +6 -0
  16. package/dist/block/definitions.js +58 -0
  17. package/dist/block/line.cjs +76 -0
  18. package/dist/block/line.d.cts +28 -0
  19. package/dist/block/line.d.ts +28 -0
  20. package/dist/block/line.js +74 -0
  21. package/dist/block/list.cjs +110 -0
  22. package/dist/block/list.d.cts +8 -0
  23. package/dist/block/list.d.ts +8 -0
  24. package/dist/block/list.js +107 -0
  25. package/dist/block/node.cjs +68 -0
  26. package/dist/block/node.d.cts +45 -0
  27. package/dist/block/node.d.ts +45 -0
  28. package/dist/block/node.js +65 -0
  29. package/dist/block/table.cjs +64 -0
  30. package/dist/block/table.d.cts +7 -0
  31. package/dist/block/table.d.ts +7 -0
  32. package/dist/block/table.js +61 -0
  33. package/dist/codec.cjs +22 -0
  34. package/dist/codec.d.cts +361 -0
  35. package/dist/codec.d.ts +361 -0
  36. package/dist/codec.js +20 -0
  37. package/dist/defaults/defaults.cjs +31 -0
  38. package/dist/defaults/defaults.d.cts +16 -0
  39. package/dist/defaults/defaults.d.ts +16 -0
  40. package/dist/defaults/defaults.js +20 -0
  41. package/dist/diagnostics/diagnostics.cjs +85 -0
  42. package/dist/diagnostics/diagnostics.d.cts +2 -0
  43. package/dist/diagnostics/diagnostics.d.ts +2 -0
  44. package/dist/diagnostics/diagnostics.js +77 -0
  45. package/dist/diagnostics-DmuWc7d8.d.cts +61 -0
  46. package/dist/diagnostics-DmuWc7d8.d.ts +61 -0
  47. package/dist/emit/emit.cjs +228 -0
  48. package/dist/emit/emit.d.cts +6 -0
  49. package/dist/emit/emit.d.ts +6 -0
  50. package/dist/emit/emit.js +227 -0
  51. package/dist/emit/front-matter.cjs +24 -0
  52. package/dist/emit/front-matter.d.cts +5 -0
  53. package/dist/emit/front-matter.d.ts +5 -0
  54. package/dist/emit/front-matter.js +23 -0
  55. package/dist/emit/image.cjs +10 -0
  56. package/dist/emit/image.d.cts +5 -0
  57. package/dist/emit/image.d.ts +5 -0
  58. package/dist/emit/image.js +9 -0
  59. package/dist/emit/inline.cjs +183 -0
  60. package/dist/emit/inline.d.cts +12 -0
  61. package/dist/emit/inline.d.ts +12 -0
  62. package/dist/emit/inline.js +180 -0
  63. package/dist/emit/table.cjs +73 -0
  64. package/dist/emit/table.d.cts +10 -0
  65. package/dist/emit/table.d.ts +10 -0
  66. package/dist/emit/table.js +72 -0
  67. package/dist/html/html.cjs +116 -0
  68. package/dist/html/html.d.cts +2 -0
  69. package/dist/html/html.d.ts +2 -0
  70. package/dist/html/html.js +113 -0
  71. package/dist/html/render.cjs +193 -0
  72. package/dist/html/render.d.cts +8 -0
  73. package/dist/html/render.d.ts +8 -0
  74. package/dist/html/render.js +189 -0
  75. package/dist/html-bkz2QTuq.d.cts +7 -0
  76. package/dist/html-bkz2QTuq.d.ts +7 -0
  77. package/dist/image/image.cjs +129 -0
  78. package/dist/image/image.d.cts +2 -0
  79. package/dist/image/image.d.ts +2 -0
  80. package/dist/image/image.js +125 -0
  81. package/dist/image-C4KYmz_L.d.cts +19 -0
  82. package/dist/image-Cm3hT5PS.d.ts +19 -0
  83. package/dist/image-DescdRgq.d.cts +12 -0
  84. package/dist/image-DescdRgq.d.ts +12 -0
  85. package/dist/index.cjs +17 -0
  86. package/dist/index.d.cts +7 -0
  87. package/dist/index.d.ts +7 -0
  88. package/dist/index.js +5 -0
  89. package/dist/inline/chars.cjs +50 -0
  90. package/dist/inline/chars.d.cts +11 -0
  91. package/dist/inline/chars.d.ts +11 -0
  92. package/dist/inline/chars.js +42 -0
  93. package/dist/inline/delimiter.cjs +136 -0
  94. package/dist/inline/delimiter.d.cts +29 -0
  95. package/dist/inline/delimiter.d.ts +29 -0
  96. package/dist/inline/delimiter.js +132 -0
  97. package/dist/inline/entity.cjs +67 -0
  98. package/dist/inline/entity.d.cts +9 -0
  99. package/dist/inline/entity.d.ts +9 -0
  100. package/dist/inline/entity.js +65 -0
  101. package/dist/inline/gfm-autolink.cjs +156 -0
  102. package/dist/inline/gfm-autolink.d.cts +5 -0
  103. package/dist/inline/gfm-autolink.d.ts +5 -0
  104. package/dist/inline/gfm-autolink.js +155 -0
  105. package/dist/inline/inline.cjs +457 -0
  106. package/dist/inline/inline.d.cts +2 -0
  107. package/dist/inline/inline.d.ts +2 -0
  108. package/dist/inline/inline.js +456 -0
  109. package/dist/inline/link.cjs +130 -0
  110. package/dist/inline/link.d.cts +2 -0
  111. package/dist/inline/link.d.ts +2 -0
  112. package/dist/inline/link.js +124 -0
  113. package/dist/inline/node.cjs +57 -0
  114. package/dist/inline/node.d.cts +23 -0
  115. package/dist/inline/node.d.ts +23 -0
  116. package/dist/inline/node.js +55 -0
  117. package/dist/inline-B50cM6cn.d.ts +10 -0
  118. package/dist/inline-C9YEGDV5.d.cts +10 -0
  119. package/dist/link-Dv4kxVjk.d.cts +18 -0
  120. package/dist/link-Dv4kxVjk.d.ts +18 -0
  121. package/dist/lower/front-matter.cjs +75 -0
  122. package/dist/lower/front-matter.d.cts +10 -0
  123. package/dist/lower/front-matter.d.ts +10 -0
  124. package/dist/lower/front-matter.js +74 -0
  125. package/dist/lower/image.cjs +29 -0
  126. package/dist/lower/image.d.cts +2 -0
  127. package/dist/lower/image.d.ts +2 -0
  128. package/dist/lower/image.js +28 -0
  129. package/dist/lower/inline.cjs +96 -0
  130. package/dist/lower/inline.d.cts +19 -0
  131. package/dist/lower/inline.d.ts +19 -0
  132. package/dist/lower/inline.js +93 -0
  133. package/dist/lower/lower.cjs +293 -0
  134. package/dist/lower/lower.d.cts +8 -0
  135. package/dist/lower/lower.d.ts +8 -0
  136. package/dist/lower/lower.js +291 -0
  137. package/dist/lower/table.cjs +27 -0
  138. package/dist/lower/table.d.cts +7 -0
  139. package/dist/lower/table.d.ts +7 -0
  140. package/dist/lower/table.js +26 -0
  141. package/dist/options/options.cjs +0 -0
  142. package/dist/options/options.d.cts +43 -0
  143. package/dist/options/options.d.ts +43 -0
  144. package/dist/options/options.js +0 -0
  145. package/dist/read.cjs +20 -0
  146. package/dist/read.d.cts +11 -0
  147. package/dist/read.d.ts +11 -0
  148. package/dist/read.js +19 -0
  149. package/dist/scan/entity-table.cjs +2131 -0
  150. package/dist/scan/entity-table.d.cts +4 -0
  151. package/dist/scan/entity-table.d.ts +4 -0
  152. package/dist/scan/entity-table.js +2130 -0
  153. package/dist/scan/scan.cjs +80 -0
  154. package/dist/scan/scan.d.cts +2 -0
  155. package/dist/scan/scan.d.ts +2 -0
  156. package/dist/scan/scan.js +78 -0
  157. package/dist/scan-DeBxgG-r.d.cts +30 -0
  158. package/dist/scan-DeBxgG-r.d.ts +30 -0
  159. package/dist/shared/list-id.cjs +36 -0
  160. package/dist/shared/list-id.d.cts +22 -0
  161. package/dist/shared/list-id.d.ts +22 -0
  162. package/dist/shared/list-id.js +32 -0
  163. package/dist/shared/style-constants.cjs +34 -0
  164. package/dist/shared/style-constants.d.cts +14 -0
  165. package/dist/shared/style-constants.d.ts +14 -0
  166. package/dist/shared/style-constants.js +23 -0
  167. package/dist/write.cjs +9 -0
  168. package/dist/write.d.cts +6 -0
  169. package/dist/write.d.ts +6 -0
  170. package/dist/write.js +8 -0
  171. package/package.json +92 -2
@@ -0,0 +1,457 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_html_html = require("../html/html.cjs");
3
+ const require_inline_chars = require("./chars.cjs");
4
+ const require_inline_entity = require("./entity.cjs");
5
+ const require_inline_delimiter = require("./delimiter.cjs");
6
+ const require_inline_node = require("./node.cjs");
7
+ const require_inline_gfm_autolink = require("./gfm-autolink.cjs");
8
+ const require_inline_link = require("./link.cjs");
9
+ //#region src/inline/inline.ts
10
+ const PLAIN_TEXT_PATTERN = /[^\n`[\]\\!<&*_~]+/y;
11
+ const URI_AUTOLINK_PATTERN = /<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>]*>/y;
12
+ const EMAIL_AUTOLINK_PATTERN = /<([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/y;
13
+ const HARD_BREAK_SPACES = " ";
14
+ const EMPTY_LABEL_LENGTH = 2;
15
+ function stripOneSurroundingSpace(content) {
16
+ if (content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) return content.slice(1, content.length - 1);
17
+ return content;
18
+ }
19
+ function createWrapper(kind, marker) {
20
+ const node = new require_inline_node.InlineNode(kind);
21
+ if (marker !== "~") node.marker = marker;
22
+ return node;
23
+ }
24
+ var InlineParser = class {
25
+ text;
26
+ references;
27
+ gfmStrikethrough;
28
+ container = new require_inline_node.InlineNode("container");
29
+ delimiters = new require_inline_delimiter.DelimiterStack();
30
+ brackets;
31
+ pos = 0;
32
+ constructor(text, references, options) {
33
+ this.text = text;
34
+ this.references = references;
35
+ this.gfmStrikethrough = options.gfmStrikethrough ?? true;
36
+ }
37
+ parse() {
38
+ while (this.pos < this.text.length) this.step();
39
+ require_inline_delimiter.processEmphasis(this.delimiters, void 0, createWrapper);
40
+ mergeAdjacentText(this.container);
41
+ return this.container;
42
+ }
43
+ step() {
44
+ const char = this.text.charAt(this.pos);
45
+ switch (char) {
46
+ case "\n":
47
+ this.parseLineBreak();
48
+ return;
49
+ case "\\":
50
+ this.parseBackslash();
51
+ return;
52
+ case "`":
53
+ this.parseCodeSpan();
54
+ return;
55
+ case "<":
56
+ this.parseAngleBracket();
57
+ return;
58
+ case "&":
59
+ this.parseEntity();
60
+ return;
61
+ case "[":
62
+ this.parseOpenBracket();
63
+ return;
64
+ case "!":
65
+ this.parseBang();
66
+ return;
67
+ case "]":
68
+ this.parseCloseBracket();
69
+ return;
70
+ default:
71
+ if (require_inline_delimiter.isDelimiterChar(char)) {
72
+ this.parseDelimiterRun(char);
73
+ return;
74
+ }
75
+ this.parsePlainText();
76
+ }
77
+ }
78
+ appendText(literal) {
79
+ const node = require_inline_node.createTextNode(literal);
80
+ this.container.appendChild(node);
81
+ return node;
82
+ }
83
+ parsePlainText() {
84
+ PLAIN_TEXT_PATTERN.lastIndex = this.pos;
85
+ const match = PLAIN_TEXT_PATTERN.exec(this.text);
86
+ if (match === null) {
87
+ this.appendText(this.text.charAt(this.pos));
88
+ this.pos += 1;
89
+ return;
90
+ }
91
+ this.appendText(match[0]);
92
+ this.pos += match[0].length;
93
+ }
94
+ parseLineBreak() {
95
+ this.pos += 1;
96
+ const last = this.container.lastChild;
97
+ if (last?.kind === "text" && last.literal.endsWith(" ")) {
98
+ const hard = last.literal.endsWith(HARD_BREAK_SPACES);
99
+ last.literal = last.literal.replace(/ +$/, "");
100
+ this.container.appendChild(new require_inline_node.InlineNode(hard ? "hardBreak" : "softBreak"));
101
+ } else this.container.appendChild(new require_inline_node.InlineNode("softBreak"));
102
+ while (this.text.charAt(this.pos) === " ") this.pos += 1;
103
+ }
104
+ parseBackslash() {
105
+ this.pos += 1;
106
+ const next = this.text.charAt(this.pos);
107
+ if (next === "\n") {
108
+ this.pos += 1;
109
+ this.container.appendChild(new require_inline_node.InlineNode("hardBreak"));
110
+ return;
111
+ }
112
+ if (require_inline_chars.isAsciiPunctuation(next)) {
113
+ this.appendText(next);
114
+ this.pos += 1;
115
+ return;
116
+ }
117
+ this.appendText("\\");
118
+ }
119
+ parseCodeSpan() {
120
+ const start = this.pos;
121
+ let openLength = 0;
122
+ while (this.text.charAt(start + openLength) === "`") openLength += 1;
123
+ const afterOpen = start + openLength;
124
+ let scan = afterOpen;
125
+ while (scan < this.text.length) {
126
+ if (this.text.charAt(scan) !== "`") {
127
+ scan += 1;
128
+ continue;
129
+ }
130
+ let runLength = 0;
131
+ while (this.text.charAt(scan + runLength) === "`") runLength += 1;
132
+ if (runLength === openLength) {
133
+ const node = new require_inline_node.InlineNode("codeSpan");
134
+ node.literal = stripOneSurroundingSpace(this.text.slice(afterOpen, scan).replace(/\n/g, " "));
135
+ this.container.appendChild(node);
136
+ this.pos = scan + runLength;
137
+ return;
138
+ }
139
+ scan += runLength;
140
+ }
141
+ this.appendText(this.text.slice(start, afterOpen));
142
+ this.pos = afterOpen;
143
+ }
144
+ parseAngleBracket() {
145
+ const uri = this.matchUriAutolink();
146
+ if (uri !== void 0) {
147
+ const node = new require_inline_node.InlineNode("autolink");
148
+ node.destination = uri;
149
+ this.container.appendChild(node);
150
+ this.pos += uri.length + 2;
151
+ return;
152
+ }
153
+ EMAIL_AUTOLINK_PATTERN.lastIndex = this.pos;
154
+ const email = EMAIL_AUTOLINK_PATTERN.exec(this.text);
155
+ const address = email?.[1];
156
+ if (email !== null && address !== void 0) {
157
+ const node = new require_inline_node.InlineNode("autolink");
158
+ node.destination = address;
159
+ node.email = true;
160
+ this.container.appendChild(node);
161
+ this.pos += email[0].length;
162
+ return;
163
+ }
164
+ const tag = require_html_html.matchHtmlTag(this.text, this.pos);
165
+ if (tag !== void 0) {
166
+ const node = new require_inline_node.InlineNode("rawHtml");
167
+ node.literal = tag;
168
+ this.container.appendChild(node);
169
+ this.pos += tag.length;
170
+ return;
171
+ }
172
+ this.appendText("<");
173
+ this.pos += 1;
174
+ }
175
+ matchUriAutolink() {
176
+ URI_AUTOLINK_PATTERN.lastIndex = this.pos;
177
+ const match = URI_AUTOLINK_PATTERN.exec(this.text);
178
+ if (match === null) return;
179
+ const uri = match[0].slice(1, match[0].length - 1);
180
+ return require_inline_chars.containsAsciiControlOrSpace(uri) ? void 0 : uri;
181
+ }
182
+ parseEntity() {
183
+ const entity = require_inline_entity.matchEntity(this.text, this.pos);
184
+ if (entity === void 0) {
185
+ this.appendText("&");
186
+ this.pos += 1;
187
+ return;
188
+ }
189
+ const node = new require_inline_node.InlineNode("entity");
190
+ node.raw = entity.raw;
191
+ node.literal = entity.value;
192
+ this.container.appendChild(node);
193
+ this.pos += entity.raw.length;
194
+ }
195
+ parseDelimiterRun(char) {
196
+ if (char === "~" && !this.gfmStrikethrough) {
197
+ this.parseLiteralRun(char);
198
+ return;
199
+ }
200
+ const run = require_inline_delimiter.scanDelimiterRun(this.text, this.pos, char);
201
+ if (run === void 0) {
202
+ this.parseLiteralRun(char);
203
+ return;
204
+ }
205
+ const node = this.appendText(this.text.slice(this.pos, this.pos + run.count));
206
+ this.pos += run.count;
207
+ if (run.canOpen || run.canClose) this.delimiters.push(char, run, node);
208
+ }
209
+ parseLiteralRun(char) {
210
+ let length = 0;
211
+ while (this.text.charAt(this.pos + length) === char) length += 1;
212
+ this.appendText(this.text.slice(this.pos, this.pos + length));
213
+ this.pos += length;
214
+ }
215
+ pushBracket(node, index, image) {
216
+ if (this.brackets !== void 0) this.brackets.bracketAfter = true;
217
+ this.brackets = {
218
+ node,
219
+ previous: this.brackets,
220
+ previousDelimiter: this.delimiters.top,
221
+ index,
222
+ image,
223
+ active: true,
224
+ bracketAfter: false
225
+ };
226
+ }
227
+ parseOpenBracket() {
228
+ const start = this.pos;
229
+ this.pos += 1;
230
+ this.pushBracket(this.appendText("["), start, false);
231
+ }
232
+ parseBang() {
233
+ const start = this.pos;
234
+ this.pos += 1;
235
+ if (this.text.charAt(this.pos) !== "[") {
236
+ this.appendText("!");
237
+ return;
238
+ }
239
+ this.pos += 1;
240
+ this.pushBracket(this.appendText("!["), start + 1, true);
241
+ }
242
+ parseCloseBracket() {
243
+ this.pos += 1;
244
+ const afterCloseBracket = this.pos;
245
+ const opener = this.brackets;
246
+ if (opener === void 0) {
247
+ this.appendText("]");
248
+ return;
249
+ }
250
+ if (!opener.active) {
251
+ this.brackets = opener.previous;
252
+ this.appendText("]");
253
+ return;
254
+ }
255
+ const target = this.resolveInlineLink() ?? this.resolveReferenceLink(opener, afterCloseBracket);
256
+ if (target === void 0) {
257
+ this.brackets = opener.previous;
258
+ this.pos = afterCloseBracket;
259
+ this.appendText("]");
260
+ return;
261
+ }
262
+ const node = new require_inline_node.InlineNode(opener.image ? "image" : "link");
263
+ node.destination = target.destination;
264
+ node.title = target.title;
265
+ let moving = opener.node.next;
266
+ while (moving !== void 0) {
267
+ const following = moving.next;
268
+ node.appendChild(moving);
269
+ moving = following;
270
+ }
271
+ this.container.appendChild(node);
272
+ require_inline_delimiter.processEmphasis(this.delimiters, opener.previousDelimiter, createWrapper);
273
+ this.brackets = opener.previous;
274
+ opener.node.unlink();
275
+ if (!opener.image) {
276
+ let earlier = this.brackets;
277
+ while (earlier !== void 0) {
278
+ if (!earlier.image) earlier.active = false;
279
+ earlier = earlier.previous;
280
+ }
281
+ }
282
+ }
283
+ resolveInlineLink() {
284
+ if (this.text.charAt(this.pos) !== "(") return;
285
+ const start = this.pos;
286
+ const destination = require_inline_link.parseLinkDestination(this.text, require_inline_link.skipInlineWhitespace(this.text, start + 1));
287
+ if (destination === void 0) {
288
+ this.pos = start;
289
+ return;
290
+ }
291
+ const afterDestination = destination.end;
292
+ let cursor = require_inline_link.skipInlineWhitespace(this.text, afterDestination);
293
+ let title;
294
+ if (cursor > afterDestination) {
295
+ title = require_inline_link.parseLinkTitle(this.text, cursor);
296
+ if (title !== void 0) cursor = require_inline_link.skipInlineWhitespace(this.text, title.end);
297
+ }
298
+ if (this.text.charAt(cursor) !== ")") {
299
+ this.pos = start;
300
+ return;
301
+ }
302
+ this.pos = cursor + 1;
303
+ return {
304
+ destination: destination.value,
305
+ title: title?.value
306
+ };
307
+ }
308
+ resolveReferenceLink(opener, afterCloseBracket) {
309
+ const labelStart = this.pos;
310
+ const labelLength = require_inline_link.matchLinkLabel(this.text, labelStart);
311
+ let label;
312
+ if (labelLength > EMPTY_LABEL_LENGTH) label = this.text.slice(labelStart, labelStart + labelLength);
313
+ else if (!opener.bracketAfter) label = this.text.slice(opener.index, afterCloseBracket);
314
+ if (labelLength > 0) this.pos = labelStart + labelLength;
315
+ if (label === void 0) return;
316
+ const definition = this.references.get(require_inline_link.normalizeLinkLabel(label));
317
+ if (definition === void 0) {
318
+ this.pos = labelStart;
319
+ return;
320
+ }
321
+ return {
322
+ destination: definition.destination,
323
+ title: definition.title
324
+ };
325
+ }
326
+ };
327
+ function mergeAdjacentText(node) {
328
+ let child = node.firstChild;
329
+ while (child !== void 0) {
330
+ if (child.kind === "text") {
331
+ let following = child.next;
332
+ while (following?.kind === "text") {
333
+ child.literal += following.literal;
334
+ const after = following.next;
335
+ following.unlink();
336
+ following = after;
337
+ }
338
+ child = child.next;
339
+ continue;
340
+ }
341
+ mergeAdjacentText(child);
342
+ child = child.next;
343
+ }
344
+ }
345
+ function flattenToPlainText(node) {
346
+ switch (node.kind) {
347
+ case "text":
348
+ case "codeSpan":
349
+ case "rawHtml":
350
+ case "entity": return node.literal;
351
+ case "autolink": return node.destination;
352
+ case "softBreak":
353
+ case "hardBreak": return " ";
354
+ default: {
355
+ let result = "";
356
+ let child = node.firstChild;
357
+ while (child !== void 0) {
358
+ result += flattenToPlainText(child);
359
+ child = child.next;
360
+ }
361
+ return result;
362
+ }
363
+ }
364
+ }
365
+ function toChildAstNodes(node) {
366
+ const children = [];
367
+ let child = node.firstChild;
368
+ while (child !== void 0) {
369
+ const converted = toAstNode(child);
370
+ if (converted !== void 0) children.push(converted);
371
+ child = child.next;
372
+ }
373
+ return children;
374
+ }
375
+ function toLinkAstNode(node) {
376
+ const children = toChildAstNodes(node);
377
+ if (node.title === void 0) return {
378
+ type: "link",
379
+ destination: node.destination,
380
+ children
381
+ };
382
+ return {
383
+ type: "link",
384
+ destination: node.destination,
385
+ title: node.title,
386
+ children
387
+ };
388
+ }
389
+ function toImageAstNode(node) {
390
+ const alt = flattenToPlainText(node);
391
+ if (node.title === void 0) return {
392
+ type: "image",
393
+ destination: node.destination,
394
+ alt
395
+ };
396
+ return {
397
+ type: "image",
398
+ destination: node.destination,
399
+ title: node.title,
400
+ alt
401
+ };
402
+ }
403
+ function toAstNode(node) {
404
+ switch (node.kind) {
405
+ case "text": return node.literal.length === 0 ? void 0 : {
406
+ type: "text",
407
+ value: node.literal
408
+ };
409
+ case "emphasis": return {
410
+ type: "emphasis",
411
+ marker: node.marker,
412
+ children: toChildAstNodes(node)
413
+ };
414
+ case "strong": return {
415
+ type: "strong",
416
+ marker: node.marker,
417
+ children: toChildAstNodes(node)
418
+ };
419
+ case "strikethrough": return {
420
+ type: "strikethrough",
421
+ children: toChildAstNodes(node)
422
+ };
423
+ case "codeSpan": return {
424
+ type: "codeSpan",
425
+ literal: node.literal
426
+ };
427
+ case "link": return toLinkAstNode(node);
428
+ case "image": return toImageAstNode(node);
429
+ case "autolink": return {
430
+ type: "autolink",
431
+ destination: node.destination,
432
+ email: node.email
433
+ };
434
+ case "hardBreak": return { type: "hardBreak" };
435
+ case "softBreak": return { type: "softBreak" };
436
+ case "rawHtml": return {
437
+ type: "rawHtml",
438
+ literal: node.literal
439
+ };
440
+ case "entity": return {
441
+ type: "entity",
442
+ raw: node.raw,
443
+ value: node.literal
444
+ };
445
+ case "container": return;
446
+ }
447
+ }
448
+ function parseInlines(content, references, options = {}) {
449
+ const root = new InlineParser(content, references, options).parse();
450
+ if (options.gfmAutolinks ?? true) {
451
+ require_inline_gfm_autolink.applyGfmAutolinks(root);
452
+ mergeAdjacentText(root);
453
+ }
454
+ return toChildAstNodes(root);
455
+ }
456
+ //#endregion
457
+ exports.parseInlines = parseInlines;
@@ -0,0 +1,2 @@
1
+ import { n as parseInlines, t as InlineParseOptions } from "../inline-C9YEGDV5.cjs";
2
+ export { InlineParseOptions, parseInlines };
@@ -0,0 +1,2 @@
1
+ import { n as parseInlines, t as InlineParseOptions } from "../inline-B50cM6cn.js";
2
+ export { InlineParseOptions, parseInlines };