markdown-codec 3.0.0 → 3.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 (76) hide show
  1. package/README.md +21 -3
  2. package/dist/ast/ast.cjs +2 -1
  3. package/dist/ast/ast.d.cts +2 -2
  4. package/dist/ast/ast.d.ts +2 -2
  5. package/dist/ast/ast.js +2 -1
  6. package/dist/{ast-DbjiuYr8.d.cts → ast-8XCbjRQT.d.cts} +14 -3
  7. package/dist/{ast-DbjiuYr8.d.ts → ast-8XCbjRQT.d.ts} +14 -3
  8. package/dist/block/block.cjs +79 -28
  9. package/dist/block/block.d.cts +6 -3
  10. package/dist/block/block.d.ts +6 -3
  11. package/dist/block/block.js +79 -28
  12. package/dist/block/definitions.d.cts +1 -1
  13. package/dist/block/definitions.d.ts +1 -1
  14. package/dist/block/node.cjs +2 -0
  15. package/dist/block/node.d.cts +3 -2
  16. package/dist/block/node.d.ts +3 -2
  17. package/dist/block/node.js +2 -0
  18. package/dist/block/table.d.cts +1 -1
  19. package/dist/block/table.d.ts +1 -1
  20. package/dist/diagnostics/diagnostics.cjs +15 -0
  21. package/dist/diagnostics/diagnostics.d.cts +2 -2
  22. package/dist/diagnostics/diagnostics.d.ts +2 -2
  23. package/dist/diagnostics/diagnostics.js +15 -1
  24. package/dist/{diagnostics-B72W0P_E.d.cts → diagnostics-BuO5-SW1.d.cts} +10 -1
  25. package/dist/{diagnostics-B72W0P_E.d.ts → diagnostics-BuO5-SW1.d.ts} +10 -1
  26. package/dist/emit/emit.cjs +77 -7
  27. package/dist/emit/emit.js +79 -9
  28. package/dist/emit/inline.cjs +2 -1
  29. package/dist/emit/inline.d.cts +1 -1
  30. package/dist/emit/inline.d.ts +1 -1
  31. package/dist/emit/inline.js +2 -1
  32. package/dist/emit/table.d.cts +1 -1
  33. package/dist/emit/table.d.ts +1 -1
  34. package/dist/footnote-CKk4JbLk.d.cts +15 -0
  35. package/dist/footnote-CKk4JbLk.d.ts +15 -0
  36. package/dist/html/render.cjs +7 -0
  37. package/dist/html/render.d.cts +1 -1
  38. package/dist/html/render.d.ts +1 -1
  39. package/dist/html/render.js +7 -0
  40. package/dist/index.cjs +2 -0
  41. package/dist/index.d.cts +3 -3
  42. package/dist/index.d.ts +3 -3
  43. package/dist/index.js +3 -3
  44. package/dist/inline/footnote.cjs +30 -0
  45. package/dist/inline/footnote.d.cts +2 -0
  46. package/dist/inline/footnote.d.ts +2 -0
  47. package/dist/inline/footnote.js +27 -0
  48. package/dist/inline/inline.cjs +28 -3
  49. package/dist/inline/inline.d.cts +1 -1
  50. package/dist/inline/inline.d.ts +1 -1
  51. package/dist/inline/inline.js +28 -3
  52. package/dist/inline/node.cjs +1 -0
  53. package/dist/inline/node.d.cts +2 -1
  54. package/dist/inline/node.d.ts +2 -1
  55. package/dist/inline/node.js +1 -0
  56. package/dist/{inline-TuBQ2TUr.d.ts → inline-B_V7bs5j.d.ts} +3 -2
  57. package/dist/{inline-uVHJ5xzT.d.cts → inline-CXVQWQnW.d.cts} +3 -2
  58. package/dist/lower/front-matter.d.cts +1 -1
  59. package/dist/lower/front-matter.d.ts +1 -1
  60. package/dist/lower/inline.cjs +7 -0
  61. package/dist/lower/inline.d.cts +2 -2
  62. package/dist/lower/inline.d.ts +2 -2
  63. package/dist/lower/inline.js +8 -1
  64. package/dist/lower/lower.cjs +51 -0
  65. package/dist/lower/lower.js +51 -0
  66. package/dist/lower/table.d.cts +1 -1
  67. package/dist/lower/table.d.ts +1 -1
  68. package/dist/options/options.d.cts +2 -1
  69. package/dist/options/options.d.ts +2 -1
  70. package/dist/read.d.cts +1 -1
  71. package/dist/read.d.ts +1 -1
  72. package/dist/shared/style-constants.cjs +2 -0
  73. package/dist/shared/style-constants.d.cts +2 -1
  74. package/dist/shared/style-constants.d.ts +2 -1
  75. package/dist/shared/style-constants.js +2 -1
  76. package/package.json +2 -2
package/dist/emit/emit.js CHANGED
@@ -1,12 +1,13 @@
1
+ import { isValidFootnoteLabel } from "../inline/footnote.js";
1
2
  import "../defaults/defaults.js";
2
- import { MarkdownDiagnosticCodes, MarkdownUnsupportedDocumentKindError, NOOP_MARKDOWN_DIAGNOSTIC_SINK } from "../diagnostics/diagnostics.js";
3
+ import { MarkdownDiagnosticCodes, MarkdownUnbalancedConstructMarkersError, MarkdownUnsupportedDocumentKindError, NOOP_MARKDOWN_DIAGNOSTIC_SINK } from "../diagnostics/diagnostics.js";
3
4
  import { parseListNumId } from "../shared/list-id.js";
4
5
  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
6
  import { emitFrontMatter } from "./front-matter.js";
6
7
  import { emitRuns } from "./inline.js";
7
8
  import { emitImage } from "./image.js";
8
9
  import { emitTable } from "./table.js";
9
- import { clampHeadingLevel } from "document-schema.js";
10
+ import { clampHeadingLevel, findConstructMarkerImbalance } from "document-schema.js";
10
11
  //#region src/emit/emit.ts
11
12
  const MAX_SETEXT_LEVEL = 2;
12
13
  const SETEXT_LEVEL_1_CHAR = "=";
@@ -192,29 +193,98 @@ function renderListRegion(items, context) {
192
193
  }
193
194
  return out;
194
195
  }
195
- function emitBlocks(blocks, context) {
196
- const parts = [];
197
- let index = 0;
196
+ function isConstructItem(item) {
197
+ return "descriptor" in item;
198
+ }
199
+ function groupConstructItems(blocks, start) {
200
+ const items = [];
201
+ let index = start;
198
202
  while (index < blocks.length) {
199
203
  const block = blocks[index];
200
204
  if (block === void 0) break;
201
- if (block.kind === "paragraph" && block.list !== void 0) {
205
+ index += 1;
206
+ if (block.kind === "constructEnd") return {
207
+ items,
208
+ next: index
209
+ };
210
+ if (block.kind === "constructStart") {
211
+ const nested = groupConstructItems(blocks, index);
212
+ items.push({
213
+ descriptor: block.descriptor,
214
+ children: nested.items
215
+ });
216
+ index = nested.next;
217
+ continue;
218
+ }
219
+ items.push({ block });
220
+ }
221
+ return {
222
+ items,
223
+ next: index
224
+ };
225
+ }
226
+ const FOOTNOTE_CONTINUATION_INDENT = 4;
227
+ function renderFootnoteDefinition(name, body) {
228
+ const marker = `[^${name}]:`;
229
+ if (body.length === 0) return marker;
230
+ const indent = " ".repeat(FOOTNOTE_CONTINUATION_INDENT);
231
+ const [firstLine = "", ...restLines] = body.split("\n");
232
+ return [`${marker} ${firstLine}`, ...restLines.map((line) => line.length === 0 ? line : `${indent}${line}`)].join("\n");
233
+ }
234
+ function renderConstruct(item, context) {
235
+ const body = renderItems(item.children, context);
236
+ const { descriptor } = item;
237
+ if (descriptor.kind === "anchor" && descriptor.anchorType === "footnote") {
238
+ if (isValidFootnoteLabel(descriptor.name)) return renderFootnoteDefinition(descriptor.name, body);
239
+ context.sink({
240
+ code: MarkdownDiagnosticCodes.CONSTRUCT_UNREPRESENTED,
241
+ severity: "info",
242
+ message: `a footnote anchor's own name "${descriptor.name}" cannot be spelled as a "[^label]:" marker (whitespace or "]" would reparse as something else); its own extent still renders in place, but the construct itself is not represented`
243
+ });
244
+ return body;
245
+ }
246
+ const detail = descriptor.kind === "anchor" ? `${descriptor.kind} (${descriptor.anchorType})` : descriptor.kind;
247
+ context.sink({
248
+ code: MarkdownDiagnosticCodes.CONSTRUCT_UNREPRESENTED,
249
+ severity: "info",
250
+ message: `a "${detail}" construct has no markdown syntax; its own extent still renders in place, but the construct itself is not represented`
251
+ });
252
+ return body;
253
+ }
254
+ function renderItems(items, context) {
255
+ const parts = [];
256
+ let index = 0;
257
+ while (index < items.length) {
258
+ const item = items[index];
259
+ if (item === void 0) break;
260
+ if (isConstructItem(item)) {
261
+ const rendered = renderConstruct(item, context);
262
+ if (rendered.length > 0) parts.push(rendered);
263
+ index += 1;
264
+ continue;
265
+ }
266
+ if (item.block.kind === "paragraph" && item.block.list !== void 0) {
202
267
  const region = [];
203
268
  let end = index;
204
- for (let candidate = blocks[end]; candidate?.kind === "paragraph" && candidate.list !== void 0; candidate = blocks[end]) {
205
- region.push(candidate);
269
+ for (let candidate = items[end]; candidate !== void 0 && !isConstructItem(candidate) && candidate.block.kind === "paragraph" && candidate.block.list !== void 0; candidate = items[end]) {
270
+ region.push(candidate.block);
206
271
  end += 1;
207
272
  }
208
273
  parts.push(renderListRegion(region, context));
209
274
  index = end;
210
275
  continue;
211
276
  }
212
- const rendered = renderTopLevelBlock(block, context);
277
+ const rendered = renderTopLevelBlock(item.block, context);
213
278
  if (rendered.length > 0) parts.push(rendered);
214
279
  index += 1;
215
280
  }
216
281
  return parts.join("\n\n");
217
282
  }
283
+ function emitBlocks(blocks, context) {
284
+ const imbalance = findConstructMarkerImbalance(blocks);
285
+ if (imbalance !== void 0) throw new MarkdownUnbalancedConstructMarkersError(imbalance.kind, imbalance.index);
286
+ return renderItems(groupConstructItems(blocks, 0).items, context);
287
+ }
218
288
  function emitMarkdown(document, options = {}) {
219
289
  if (document.kind !== "wordprocessing") throw new MarkdownUnsupportedDocumentKindError(document.kind);
220
290
  const context = {
@@ -85,6 +85,7 @@ function renderLeaf(run, context) {
85
85
  });
86
86
  return renderCodeSpan(run.text);
87
87
  }
88
+ if (run.fontFamily === "Footnote Reference") return run.text;
88
89
  if (run.fontFamily === "Cambria Math") return `\\(${run.text}\\)`;
89
90
  return escapeMarkdownText(run.text);
90
91
  }
@@ -135,7 +136,7 @@ function renderNestedStyles(runs, depth, context) {
135
136
  return out;
136
137
  }
137
138
  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" || run.fontFamily === "Cambria Math") return false;
139
+ 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" || run.fontFamily === "Footnote Reference") return false;
139
140
  return run.text === run.hyperlink || run.hyperlink === `mailto:${run.text}`;
140
141
  }
141
142
  function escapeLinkDestination(destination) {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-BuO5-SW1.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-B72W0P_E.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-BuO5-SW1.js";
2
2
  import { ContentRun } from "document-schema.js";
3
3
  //#region src/emit/inline.d.ts
4
4
  interface InlineEmitContext {
@@ -84,6 +84,7 @@ function renderLeaf(run, context) {
84
84
  });
85
85
  return renderCodeSpan(run.text);
86
86
  }
87
+ if (run.fontFamily === "Footnote Reference") return run.text;
87
88
  if (run.fontFamily === "Cambria Math") return `\\(${run.text}\\)`;
88
89
  return escapeMarkdownText(run.text);
89
90
  }
@@ -134,7 +135,7 @@ function renderNestedStyles(runs, depth, context) {
134
135
  return out;
135
136
  }
136
137
  function isPlainAutolink(run) {
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;
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" || run.fontFamily === "Footnote Reference") return false;
138
139
  return run.text === run.hyperlink || run.hyperlink === `mailto:${run.text}`;
139
140
  }
140
141
  function escapeLinkDestination(destination) {
@@ -1,4 +1,4 @@
1
- import { i as MarkdownDiagnosticSink } from "../diagnostics-B72W0P_E.cjs";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-BuO5-SW1.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-B72W0P_E.js";
1
+ import { i as MarkdownDiagnosticSink } from "../diagnostics-BuO5-SW1.js";
2
2
  import { InlineEmitContext } from "./inline.js";
3
3
  import { ContentTable } from "document-schema.js";
4
4
  //#region src/emit/table.d.ts
@@ -0,0 +1,15 @@
1
+ //#region src/inline/footnote.d.ts
2
+ interface FootnoteLabelMatch {
3
+ readonly label: string;
4
+ readonly end: number;
5
+ }
6
+ declare function matchFootnoteLabel(text: string, start: number): FootnoteLabelMatch | undefined;
7
+ interface FootnoteDefinitionMatch {
8
+ readonly label: string;
9
+ readonly markerLength: number;
10
+ }
11
+ declare function matchFootnoteDefinitionMarker(lineText: string): FootnoteDefinitionMatch | undefined;
12
+ type FootnoteLabelSet = ReadonlySet<string>;
13
+ declare function isValidFootnoteLabel(label: string): boolean;
14
+ //#endregion
15
+ export { matchFootnoteDefinitionMarker as a, isValidFootnoteLabel as i, FootnoteLabelMatch as n, matchFootnoteLabel as o, FootnoteLabelSet as r, FootnoteDefinitionMatch as t };
@@ -0,0 +1,15 @@
1
+ //#region src/inline/footnote.d.ts
2
+ interface FootnoteLabelMatch {
3
+ readonly label: string;
4
+ readonly end: number;
5
+ }
6
+ declare function matchFootnoteLabel(text: string, start: number): FootnoteLabelMatch | undefined;
7
+ interface FootnoteDefinitionMatch {
8
+ readonly label: string;
9
+ readonly markerLength: number;
10
+ }
11
+ declare function matchFootnoteDefinitionMarker(lineText: string): FootnoteDefinitionMatch | undefined;
12
+ type FootnoteLabelSet = ReadonlySet<string>;
13
+ declare function isValidFootnoteLabel(label: string): boolean;
14
+ //#endregion
15
+ export { matchFootnoteDefinitionMarker as a, isValidFootnoteLabel as i, FootnoteLabelMatch as n, matchFootnoteLabel as o, FootnoteLabelSet as r, FootnoteDefinitionMatch as t };
@@ -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 "footnoteReference": return escapeHtml(`[^${node.label}]`);
82
83
  case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
83
84
  }
84
85
  }
@@ -140,6 +141,12 @@ var HtmlRenderer = class {
140
141
  this.out += `$$\n${escapeHtml(node.literal)}\n$$\n`;
141
142
  this.cr();
142
143
  return;
144
+ case "footnoteDefinition":
145
+ this.cr();
146
+ this.out += `${escapeHtml(`[^${node.label}]:`)}\n`;
147
+ this.render(node.children, false);
148
+ this.cr();
149
+ return;
143
150
  case "document":
144
151
  case "listItem":
145
152
  case "tableRow":
@@ -1,4 +1,4 @@
1
- import { g as MarkdownInlineNode, s as MarkdownDocumentNode } from "../ast-DbjiuYr8.cjs";
1
+ import { s as MarkdownDocumentNode, v as MarkdownInlineNode } from "../ast-8XCbjRQT.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-DbjiuYr8.js";
1
+ import { s as MarkdownDocumentNode, v as MarkdownInlineNode } from "../ast-8XCbjRQT.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 "footnoteReference": return escapeHtml(`[^${node.label}]`);
81
82
  case "mathInline": return `\\(${escapeHtml(node.literal)}\\)`;
82
83
  }
83
84
  }
@@ -139,6 +140,12 @@ var HtmlRenderer = class {
139
140
  this.out += `$$\n${escapeHtml(node.literal)}\n$$\n`;
140
141
  this.cr();
141
142
  return;
143
+ case "footnoteDefinition":
144
+ this.cr();
145
+ this.out += `${escapeHtml(`[^${node.label}]:`)}\n`;
146
+ this.render(node.children, false);
147
+ this.cr();
148
+ return;
142
149
  case "document":
143
150
  case "listItem":
144
151
  case "tableRow":
package/dist/index.cjs CHANGED
@@ -6,6 +6,7 @@ const require_read = require("./read.cjs");
6
6
  const require_write = require("./write.cjs");
7
7
  const require_codec = require("./codec.cjs");
8
8
  exports.CODE_BLOCK_STYLE_ID = require_shared_style_constants.CODE_BLOCK_STYLE_ID;
9
+ exports.FOOTNOTE_REFERENCE_FONT_MARKER = require_shared_style_constants.FOOTNOTE_REFERENCE_FONT_MARKER;
9
10
  exports.HORIZONTAL_RULE_STYLE_ID = require_shared_style_constants.HORIZONTAL_RULE_STYLE_ID;
10
11
  exports.HTML_PREFORMATTED_STYLE_ID = require_shared_style_constants.HTML_PREFORMATTED_STYLE_ID;
11
12
  exports.MAX_HEADING_STYLE_LEVEL = require_shared_style_constants.MAX_HEADING_STYLE_LEVEL;
@@ -16,6 +17,7 @@ exports.MarkdownInputTooLargeError = require_diagnostics_diagnostics.MarkdownInp
16
17
  exports.MarkdownInvalidUtf8Error = require_diagnostics_diagnostics.MarkdownInvalidUtf8Error;
17
18
  exports.MarkdownNestingLimitExceededError = require_diagnostics_diagnostics.MarkdownNestingLimitExceededError;
18
19
  exports.MarkdownParseError = require_diagnostics_diagnostics.MarkdownParseError;
20
+ exports.MarkdownUnbalancedConstructMarkersError = require_diagnostics_diagnostics.MarkdownUnbalancedConstructMarkersError;
19
21
  exports.MarkdownUnsupportedDocumentKindError = require_diagnostics_diagnostics.MarkdownUnsupportedDocumentKindError;
20
22
  exports.MarkdownWriteError = require_diagnostics_diagnostics.MarkdownWriteError;
21
23
  exports.NOOP_MARKDOWN_DIAGNOSTIC_SINK = require_diagnostics_diagnostics.NOOP_MARKDOWN_DIAGNOSTIC_SINK;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
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";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as MarkdownWriteError, f as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnbalancedConstructMarkersError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownUnsupportedDocumentKindError } from "./diagnostics-BuO5-SW1.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";
5
5
  import { ReadMarkdownResult, readMarkdown } from "./read.cjs";
6
6
  import { writeMarkdown } from "./write.cjs";
7
7
  import { ListNumIdInfo, ListNumIdMintOptions, NumIdMintState, createNumIdMintState, mintListNumId, mintedListType, parseListNumId } from "./shared/list-id.cjs";
8
- import { CODE_BLOCK_STYLE_ID, 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, 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, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, type NumIdMintState, QUOTE_INDENT_PT, QUOTE_STYLE_ID, type ReadMarkdownOptions, type ReadMarkdownResult, type WriteMarkdownOptions, type WriteMarkdownStyleOptions, createNumIdMintState, headingStyleId, markdownCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, writeMarkdown };
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 ReadMarkdownOptions, type ReadMarkdownResult, type WriteMarkdownOptions, type WriteMarkdownStyleOptions, createNumIdMintState, headingStyleId, markdownCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, writeMarkdown };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
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";
1
+ import { a as MarkdownInputTooLargeError, c as MarkdownParseError, d as MarkdownWriteError, f as NOOP_MARKDOWN_DIAGNOSTIC_SINK, i as MarkdownDiagnosticSink, l as MarkdownUnbalancedConstructMarkersError, n as MarkdownDiagnosticCodes, o as MarkdownInvalidUtf8Error, r as MarkdownDiagnosticSeverity, s as MarkdownNestingLimitExceededError, t as MarkdownDiagnostic, u as MarkdownUnsupportedDocumentKindError } from "./diagnostics-BuO5-SW1.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";
5
5
  import { ReadMarkdownResult, readMarkdown } from "./read.js";
6
6
  import { writeMarkdown } from "./write.js";
7
7
  import { ListNumIdInfo, ListNumIdMintOptions, NumIdMintState, createNumIdMintState, mintListNumId, mintedListType, parseListNumId } from "./shared/list-id.js";
8
- import { CODE_BLOCK_STYLE_ID, 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, 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, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, type NumIdMintState, QUOTE_INDENT_PT, QUOTE_STYLE_ID, type ReadMarkdownOptions, type ReadMarkdownResult, type WriteMarkdownOptions, type WriteMarkdownStyleOptions, createNumIdMintState, headingStyleId, markdownCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, writeMarkdown };
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 ReadMarkdownOptions, type ReadMarkdownResult, type WriteMarkdownOptions, type WriteMarkdownStyleOptions, createNumIdMintState, headingStyleId, markdownCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, writeMarkdown };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { MarkdownDiagnosticCodes, MarkdownInputTooLargeError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownParseError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK } from "./diagnostics/diagnostics.js";
1
+ import { MarkdownDiagnosticCodes, MarkdownInputTooLargeError, 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
- import { CODE_BLOCK_STYLE_ID, 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";
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 } from "./read.js";
5
5
  import { writeMarkdown } from "./write.js";
6
6
  import { MarkdownBytesSchema, markdownCodec } from "./codec.js";
7
- export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, MarkdownBytesSchema, MarkdownDiagnosticCodes, MarkdownInputTooLargeError, MarkdownInvalidUtf8Error, MarkdownNestingLimitExceededError, MarkdownParseError, MarkdownUnsupportedDocumentKindError, MarkdownWriteError, NOOP_MARKDOWN_DIAGNOSTIC_SINK, QUOTE_INDENT_PT, QUOTE_STYLE_ID, createNumIdMintState, headingStyleId, markdownCodec, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, writeMarkdown };
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, mintListNumId, mintedListType, parseHeadingStyleId, parseListNumId, readMarkdown, writeMarkdown };
@@ -0,0 +1,30 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/inline/footnote.ts
3
+ const FOOTNOTE_LABEL_PATTERN = /\[\^([^\s[\]]+)\]/y;
4
+ const FOOTNOTE_LABEL_ONLY_PATTERN = /^[^\s[\]]+$/;
5
+ function matchFootnoteLabel(text, start) {
6
+ FOOTNOTE_LABEL_PATTERN.lastIndex = start;
7
+ const match = FOOTNOTE_LABEL_PATTERN.exec(text);
8
+ if (match === null) return;
9
+ const label = match[1];
10
+ if (label === void 0) return;
11
+ return {
12
+ label,
13
+ end: start + match[0].length
14
+ };
15
+ }
16
+ function matchFootnoteDefinitionMarker(lineText) {
17
+ const match = matchFootnoteLabel(lineText, 0);
18
+ if (match === void 0 || lineText.charAt(match.end) !== ":") return;
19
+ return {
20
+ label: match.label,
21
+ markerLength: match.end + 1
22
+ };
23
+ }
24
+ function isValidFootnoteLabel(label) {
25
+ return FOOTNOTE_LABEL_ONLY_PATTERN.test(label);
26
+ }
27
+ //#endregion
28
+ exports.isValidFootnoteLabel = isValidFootnoteLabel;
29
+ exports.matchFootnoteDefinitionMarker = matchFootnoteDefinitionMarker;
30
+ exports.matchFootnoteLabel = matchFootnoteLabel;
@@ -0,0 +1,2 @@
1
+ import { a as matchFootnoteDefinitionMarker, i as isValidFootnoteLabel, n as FootnoteLabelMatch, o as matchFootnoteLabel, r as FootnoteLabelSet, t as FootnoteDefinitionMatch } from "../footnote-CKk4JbLk.cjs";
2
+ export { FootnoteDefinitionMatch, FootnoteLabelMatch, FootnoteLabelSet, isValidFootnoteLabel, matchFootnoteDefinitionMarker, matchFootnoteLabel };
@@ -0,0 +1,2 @@
1
+ import { a as matchFootnoteDefinitionMarker, i as isValidFootnoteLabel, n as FootnoteLabelMatch, o as matchFootnoteLabel, r as FootnoteLabelSet, t as FootnoteDefinitionMatch } from "../footnote-CKk4JbLk.js";
2
+ export { FootnoteDefinitionMatch, FootnoteLabelMatch, FootnoteLabelSet, isValidFootnoteLabel, matchFootnoteDefinitionMarker, matchFootnoteLabel };
@@ -0,0 +1,27 @@
1
+ //#region src/inline/footnote.ts
2
+ const FOOTNOTE_LABEL_PATTERN = /\[\^([^\s[\]]+)\]/y;
3
+ const FOOTNOTE_LABEL_ONLY_PATTERN = /^[^\s[\]]+$/;
4
+ function matchFootnoteLabel(text, start) {
5
+ FOOTNOTE_LABEL_PATTERN.lastIndex = start;
6
+ const match = FOOTNOTE_LABEL_PATTERN.exec(text);
7
+ if (match === null) return;
8
+ const label = match[1];
9
+ if (label === void 0) return;
10
+ return {
11
+ label,
12
+ end: start + match[0].length
13
+ };
14
+ }
15
+ function matchFootnoteDefinitionMarker(lineText) {
16
+ const match = matchFootnoteLabel(lineText, 0);
17
+ if (match === void 0 || lineText.charAt(match.end) !== ":") return;
18
+ return {
19
+ label: match.label,
20
+ markerLength: match.end + 1
21
+ };
22
+ }
23
+ function isValidFootnoteLabel(label) {
24
+ return FOOTNOTE_LABEL_ONLY_PATTERN.test(label);
25
+ }
26
+ //#endregion
27
+ export { isValidFootnoteLabel, matchFootnoteDefinitionMarker, matchFootnoteLabel };
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_inline_footnote = require("./footnote.cjs");
2
3
  const require_html_html = require("../html/html.cjs");
3
4
  const require_inline_chars = require("./chars.cjs");
4
5
  const require_inline_entity = require("./entity.cjs");
@@ -25,14 +26,16 @@ function createWrapper(kind, marker) {
25
26
  var InlineParser = class {
26
27
  text;
27
28
  references;
29
+ footnotes;
28
30
  gfmStrikethrough;
29
31
  container = new require_inline_node.InlineNode("container");
30
32
  delimiters = new require_inline_delimiter.DelimiterStack();
31
33
  brackets;
32
34
  pos = 0;
33
- constructor(text, references, options) {
35
+ constructor(text, references, footnotes, options) {
34
36
  this.text = text;
35
37
  this.references = references;
38
+ this.footnotes = footnotes;
36
39
  this.gfmStrikethrough = options.gfmStrikethrough ?? true;
37
40
  }
38
41
  parse() {
@@ -238,9 +241,22 @@ var InlineParser = class {
238
241
  }
239
242
  parseOpenBracket() {
240
243
  const start = this.pos;
244
+ const footnote = this.matchFootnoteReference();
245
+ if (footnote !== void 0) {
246
+ const node = new require_inline_node.InlineNode("footnoteReference");
247
+ node.label = footnote.label;
248
+ this.container.appendChild(node);
249
+ this.pos = footnote.end;
250
+ return;
251
+ }
241
252
  this.pos += 1;
242
253
  this.pushBracket(this.appendText("["), start, false);
243
254
  }
255
+ matchFootnoteReference() {
256
+ const match = require_inline_footnote.matchFootnoteLabel(this.text, this.pos);
257
+ if (match === void 0 || !this.footnotes.has(match.label)) return;
258
+ return match;
259
+ }
244
260
  parseBang() {
245
261
  const start = this.pos;
246
262
  this.pos += 1;
@@ -248,6 +264,10 @@ var InlineParser = class {
248
264
  this.appendText("!");
249
265
  return;
250
266
  }
267
+ if (this.matchFootnoteReference() !== void 0) {
268
+ this.appendText("!");
269
+ return;
270
+ }
251
271
  this.pos += 1;
252
272
  this.pushBracket(this.appendText("!["), start + 1, true);
253
273
  }
@@ -363,6 +383,7 @@ function flattenToPlainText(node) {
363
383
  case "autolink": return node.destination;
364
384
  case "softBreak":
365
385
  case "hardBreak": return " ";
386
+ case "footnoteReference": return `[^${node.label}]`;
366
387
  default: {
367
388
  let result = "";
368
389
  let child = node.firstChild;
@@ -458,11 +479,15 @@ function toAstNode(node) {
458
479
  type: "mathInline",
459
480
  literal: node.literal
460
481
  };
482
+ case "footnoteReference": return {
483
+ type: "footnoteReference",
484
+ label: node.label
485
+ };
461
486
  case "container": return;
462
487
  }
463
488
  }
464
- function parseInlines(content, references, options = {}) {
465
- const root = new InlineParser(content, references, options).parse();
489
+ function parseInlines(content, references, footnotes, options = {}) {
490
+ const root = new InlineParser(content, references, footnotes, options).parse();
466
491
  if (options.gfmAutolinks ?? true) {
467
492
  require_inline_gfm_autolink.applyGfmAutolinks(root);
468
493
  mergeAdjacentText(root);
@@ -1,2 +1,2 @@
1
- import { n as parseInlines, t as InlineParseOptions } from "../inline-uVHJ5xzT.cjs";
1
+ import { n as parseInlines, t as InlineParseOptions } from "../inline-CXVQWQnW.cjs";
2
2
  export { InlineParseOptions, parseInlines };
@@ -1,2 +1,2 @@
1
- import { n as parseInlines, t as InlineParseOptions } from "../inline-TuBQ2TUr.js";
1
+ import { n as parseInlines, t as InlineParseOptions } from "../inline-B_V7bs5j.js";
2
2
  export { InlineParseOptions, parseInlines };
@@ -1,3 +1,4 @@
1
+ import { matchFootnoteLabel } from "./footnote.js";
1
2
  import { matchHtmlTag } from "../html/html.js";
2
3
  import { containsAsciiControlOrSpace, isAsciiPunctuation } from "./chars.js";
3
4
  import { matchEntity } from "./entity.js";
@@ -24,14 +25,16 @@ function createWrapper(kind, marker) {
24
25
  var InlineParser = class {
25
26
  text;
26
27
  references;
28
+ footnotes;
27
29
  gfmStrikethrough;
28
30
  container = new InlineNode("container");
29
31
  delimiters = new DelimiterStack();
30
32
  brackets;
31
33
  pos = 0;
32
- constructor(text, references, options) {
34
+ constructor(text, references, footnotes, options) {
33
35
  this.text = text;
34
36
  this.references = references;
37
+ this.footnotes = footnotes;
35
38
  this.gfmStrikethrough = options.gfmStrikethrough ?? true;
36
39
  }
37
40
  parse() {
@@ -237,9 +240,22 @@ var InlineParser = class {
237
240
  }
238
241
  parseOpenBracket() {
239
242
  const start = this.pos;
243
+ const footnote = this.matchFootnoteReference();
244
+ if (footnote !== void 0) {
245
+ const node = new InlineNode("footnoteReference");
246
+ node.label = footnote.label;
247
+ this.container.appendChild(node);
248
+ this.pos = footnote.end;
249
+ return;
250
+ }
240
251
  this.pos += 1;
241
252
  this.pushBracket(this.appendText("["), start, false);
242
253
  }
254
+ matchFootnoteReference() {
255
+ const match = matchFootnoteLabel(this.text, this.pos);
256
+ if (match === void 0 || !this.footnotes.has(match.label)) return;
257
+ return match;
258
+ }
243
259
  parseBang() {
244
260
  const start = this.pos;
245
261
  this.pos += 1;
@@ -247,6 +263,10 @@ var InlineParser = class {
247
263
  this.appendText("!");
248
264
  return;
249
265
  }
266
+ if (this.matchFootnoteReference() !== void 0) {
267
+ this.appendText("!");
268
+ return;
269
+ }
250
270
  this.pos += 1;
251
271
  this.pushBracket(this.appendText("!["), start + 1, true);
252
272
  }
@@ -362,6 +382,7 @@ function flattenToPlainText(node) {
362
382
  case "autolink": return node.destination;
363
383
  case "softBreak":
364
384
  case "hardBreak": return " ";
385
+ case "footnoteReference": return `[^${node.label}]`;
365
386
  default: {
366
387
  let result = "";
367
388
  let child = node.firstChild;
@@ -457,11 +478,15 @@ function toAstNode(node) {
457
478
  type: "mathInline",
458
479
  literal: node.literal
459
480
  };
481
+ case "footnoteReference": return {
482
+ type: "footnoteReference",
483
+ label: node.label
484
+ };
460
485
  case "container": return;
461
486
  }
462
487
  }
463
- function parseInlines(content, references, options = {}) {
464
- const root = new InlineParser(content, references, options).parse();
488
+ function parseInlines(content, references, footnotes, options = {}) {
489
+ const root = new InlineParser(content, references, footnotes, options).parse();
465
490
  if (options.gfmAutolinks ?? true) {
466
491
  applyGfmAutolinks(root);
467
492
  mergeAdjacentText(root);
@@ -8,6 +8,7 @@ var InlineNode = class {
8
8
  email = false;
9
9
  marker = "*";
10
10
  raw = "";
11
+ label = "";
11
12
  parent;
12
13
  firstChild;
13
14
  lastChild;
@@ -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' | 'mathInline' | 'container';
2
+ type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'mathInline' | 'footnoteReference' | 'container';
3
3
  declare class InlineNode {
4
4
  readonly kind: InlineNodeKind;
5
5
  literal: string;
@@ -8,6 +8,7 @@ declare class InlineNode {
8
8
  email: boolean;
9
9
  marker: '_' | '*';
10
10
  raw: string;
11
+ label: string;
11
12
  parent: InlineNode | undefined;
12
13
  firstChild: InlineNode | undefined;
13
14
  lastChild: InlineNode | undefined;
@@ -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' | 'mathInline' | 'container';
2
+ type InlineNodeKind = 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'codeSpan' | 'link' | 'image' | 'autolink' | 'hardBreak' | 'softBreak' | 'rawHtml' | 'entity' | 'mathInline' | 'footnoteReference' | 'container';
3
3
  declare class InlineNode {
4
4
  readonly kind: InlineNodeKind;
5
5
  literal: string;
@@ -8,6 +8,7 @@ declare class InlineNode {
8
8
  email: boolean;
9
9
  marker: '_' | '*';
10
10
  raw: string;
11
+ label: string;
11
12
  parent: InlineNode | undefined;
12
13
  firstChild: InlineNode | undefined;
13
14
  lastChild: InlineNode | undefined;
@@ -7,6 +7,7 @@ var InlineNode = class {
7
7
  email = false;
8
8
  marker = "*";
9
9
  raw = "";
10
+ label = "";
10
11
  parent;
11
12
  firstChild;
12
13
  lastChild;