@meowdown/core 0.64.0 → 0.64.2

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 (3) hide show
  1. package/dist/index.d.ts +340 -117
  2. package/dist/index.js +577 -342
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -21,12 +21,18 @@ import { VirtualElement } from "@floating-ui/dom";
21
21
  * - `lossy`: content changed - a non-blank line differs, or the re-parsed doc does.
22
22
  */
23
23
  type RoundTripFidelity = 'exact' | 'normalizing' | 'lossy';
24
- /** Options for {@link checkRoundTrip}. */
24
+ /**
25
+ * Options for {@link checkRoundTrip}.
26
+ */
25
27
  interface CheckRoundTripOptions {
26
- /** Whether to handle a leading `---` frontmatter block. Off by default. */
28
+ /**
29
+ * Whether to handle a leading `---` frontmatter block. Off by default.
30
+ */
27
31
  frontmatter?: boolean;
28
32
  }
29
- /** Classify how `markdown` survives the editor's parse-then-serialize round trip. */
33
+ /**
34
+ * Classify how `markdown` survives the editor's parse-then-serialize round trip.
35
+ */
30
36
  declare function checkRoundTrip(markdown: string, options?: CheckRoundTripOptions): RoundTripFidelity;
31
37
  //#endregion
32
38
  //#region src/extensions/frontmatter.d.ts
@@ -175,19 +181,33 @@ declare function defineHTMLComment(): HTMLCommentExtension;
175
181
  * (plus an optional trailing size comment) or a resolved wiki image embed.
176
182
  */
177
183
  interface MdImageAttrs {
178
- /** The image destination, exactly as written in the source. */
184
+ /**
185
+ * The image destination, exactly as written in the source.
186
+ */
179
187
  src: string;
180
- /** The image alt text. */
188
+ /**
189
+ * The image alt text.
190
+ */
181
191
  alt: string;
182
- /** The image title, or `''` when the source has none. */
192
+ /**
193
+ * The image title, or `''` when the source has none.
194
+ */
183
195
  title: string;
184
- /** Display width in CSS pixels from the trailing comment, or `null`. */
196
+ /**
197
+ * Display width in CSS pixels from the trailing comment, or `null`.
198
+ */
185
199
  width: number | null;
186
- /** Display height in CSS pixels from the trailing comment, or `null`. */
200
+ /**
201
+ * Display height in CSS pixels from the trailing comment, or `null`.
202
+ */
187
203
  height: number | null;
188
- /** `wikiEmbed` when the source is `![[target]]`; otherwise `null`. */
204
+ /**
205
+ * `wikiEmbed` when the source is `![[target]]`; otherwise `null`.
206
+ */
189
207
  syntax: 'wikiEmbed' | null;
190
- /** Original wiki-embed target used when persisting a resized image, or `null`. */
208
+ /**
209
+ * Original wiki-embed target used when persisting a resized image, or `null`.
210
+ */
191
211
  wikiTarget: string | null;
192
212
  }
193
213
  interface MdLinkTextAttrs {
@@ -202,11 +222,17 @@ interface MdWikilinkAttrs {
202
222
  * `resolveFileLink` claimed as a file attachment, rendered as a file pill.
203
223
  */
204
224
  interface MdFileAttrs {
205
- /** The link destination, exactly as written in the source. */
225
+ /**
226
+ * The link destination, exactly as written in the source.
227
+ */
206
228
  href: string;
207
- /** The display name: the raw label slice, or the `href` basename when the label is empty. */
229
+ /**
230
+ * The display name: the raw label slice, or the `href` basename when the label is empty.
231
+ */
208
232
  name: string;
209
- /** The link title, or `''` when the source has none. */
233
+ /**
234
+ * The link title, or `''` when the source has none.
235
+ */
210
236
  title: string;
211
237
  }
212
238
  /**
@@ -214,34 +240,53 @@ interface MdFileAttrs {
214
240
  * math expression, rendered by `MathMarkView`.
215
241
  */
216
242
  interface MdMathAttrs {
217
- /** The TeX source between the dollar delimiters. */
243
+ /**
244
+ * The TeX source between the dollar delimiters.
245
+ */
218
246
  formula: string;
219
247
  }
220
- /** mdPack keys for units that store no extra data; the syntax marks carry it. */
221
- type MdPackSimpleKey = 'bold' | 'italic' | 'code' | 'strike' | 'highlight' | 'autolink' | 'math';
222
248
  /**
223
- * Content-derived identity of one inline syntax unit. Adjacent units of the
224
- * same kind are kept apart by it (so they do not merge into one mark run), and
225
- * it stays stable when unrelated text in the block is edited, so editing one
226
- * unit never re-marks the others. `data` carries the unit's parsed payload (a
227
- * link's `href`/`title`, an image's `src`) so callers read it off the mark
228
- * instead of re-parsing the text.
249
+ * Content-derived identity of one inline syntax unit.
250
+ *
251
+ * - `key`: the unit's kind. It keeps adjacent same-kind units apart and stays
252
+ * stable when unrelated text in the block is edited, so editing one unit
253
+ * never re-marks the others.
254
+ * - `data`: the unit's parsed data, read off the mark instead of
255
+ * re-parsing the text.
256
+ * - `slot`: `1` when the pack would otherwise equal the pack of the unit
257
+ * ending exactly where this one starts; equal packs would merge the two
258
+ * units into one mark run and one mark view.
259
+ * - `revealInFocus`/`revealInHide`: the mark modes in which the unit's
260
+ * source reveals around the caret.
229
261
  */
230
262
  type MdPackAttrs = {
263
+ key: 'italic' | 'bold' | 'code' | 'del' | 'highlight' | 'autolink';
264
+ data?: null;
265
+ slot?: 1 | null;
266
+ revealInFocus: true;
267
+ revealInHide?: null;
268
+ } | {
231
269
  key: 'link';
232
270
  data: {
233
271
  href: string;
234
272
  title: string;
235
- reference?: true;
273
+ isReference: boolean;
236
274
  };
275
+ slot?: 1 | null;
276
+ revealInFocus: true;
277
+ revealInHide?: null;
237
278
  } | {
238
- key: 'image';
239
- data: {
240
- src: string;
241
- };
279
+ key: 'math';
280
+ data?: null;
281
+ slot?: 1 | null;
282
+ revealInFocus: true;
283
+ revealInHide: true;
242
284
  } | {
243
- key: MdPackSimpleKey;
285
+ key: 'wikilink' | 'image' | 'file';
244
286
  data?: null;
287
+ slot?: 1 | null;
288
+ revealInFocus?: null;
289
+ revealInHide?: null;
245
290
  };
246
291
  //#endregion
247
292
  //#region src/utils/range.d.ts
@@ -252,7 +297,9 @@ interface PositionRange {
252
297
  //#endregion
253
298
  //#region src/extensions/get-link-unit-at.d.ts
254
299
  interface LinkUnit {
255
- /** Whole inline link, reference link, or autolink range. */
300
+ /**
301
+ * Whole inline link, reference link, or autolink range.
302
+ */
256
303
  unit: PositionRange;
257
304
  /**
258
305
  * The visible text of the link: the `[ ]` interior for a full link, the URL
@@ -261,13 +308,21 @@ interface LinkUnit {
261
308
  * whose collapsed glyphs measure at bogus coordinates.
262
309
  */
263
310
  text: PositionRange;
264
- /** Interior of `[ ]`. Absent for an autolink. */
311
+ /**
312
+ * Interior of `[ ]`. Absent for an autolink.
313
+ */
265
314
  label?: PositionRange;
266
- /** Interior of `( )`. What `updateLink` rewrites. Absent for an autolink. */
315
+ /**
316
+ * Interior of `( )`. What `updateLink` rewrites. Absent for an autolink.
317
+ */
267
318
  dest?: PositionRange;
268
- /** The link URL. Could be an empty string. */
319
+ /**
320
+ * The link URL. Could be an empty string.
321
+ */
269
322
  href: string;
270
- /** The link title, unquoted. Could be an empty string. */
323
+ /**
324
+ * The link title, unquoted. Could be an empty string.
325
+ */
271
326
  title: string;
272
327
  }
273
328
  /**
@@ -292,9 +347,13 @@ interface InsertLinkOptions {
292
347
  wrapText?: boolean;
293
348
  }
294
349
  declare function insertLink({ href, title, wrapText }?: InsertLinkOptions): Command;
295
- /** Rewrite the `( ... )` of the link at the caret/selection. */
350
+ /**
351
+ * Rewrite the `( ... )` of the link at the caret/selection.
352
+ */
296
353
  declare function updateLink(attrs: LinkAttrs): Command;
297
- /** Unwrap the link at the caret: keep the label text, drop the syntax. */
354
+ /**
355
+ * Unwrap the link at the caret: keep the label text, drop the syntax.
356
+ */
298
357
  declare function removeLink(): Command;
299
358
  declare function defineLinkCommands(): Extension<{
300
359
  Commands: {
@@ -312,9 +371,13 @@ type LinkEditHandler = (options: LinkEditOptions) => void;
312
371
  declare function defineLinkEditKeymap(onLinkEdit: LinkEditHandler): PlainExtension;
313
372
  //#endregion
314
373
  //#region src/extensions/pending-replacement.d.ts
315
- /** Where an accepted replacement lands relative to the source range. */
374
+ /**
375
+ * Where an accepted replacement lands relative to the source range.
376
+ */
316
377
  type PendingReplacementMode = 'replace' | 'append';
317
- /** How a pending replacement ended. */
378
+ /**
379
+ * How a pending replacement ended.
380
+ */
318
381
  type PendingReplacementOutcome = 'accepted' | 'discarded';
319
382
  /**
320
383
  * A staged replacement: Markdown text accumulating over `[from, to]` that is
@@ -322,27 +385,45 @@ type PendingReplacementOutcome = 'accepted' | 'discarded';
322
385
  * untouched; discarding is a no-op.
323
386
  */
324
387
  interface PendingReplacement {
325
- /** Start of the source range the replacement targets. */
388
+ /**
389
+ * Start of the source range the replacement targets.
390
+ */
326
391
  from: number;
327
- /** End of the source range the replacement targets. */
392
+ /**
393
+ * End of the source range the replacement targets.
394
+ */
328
395
  to: number;
329
- /** The Markdown accumulated so far (e.g. streamed from an AI provider). */
396
+ /**
397
+ * The Markdown accumulated so far (e.g. streamed from an AI provider).
398
+ */
330
399
  text: string;
331
- /** Whether accepting replaces the source range or inserts after its block. */
400
+ /**
401
+ * Whether accepting replaces the source range or inserts after its block.
402
+ */
332
403
  mode: PendingReplacementMode;
333
404
  }
334
- /** The active pending replacement, or null when there is none. */
405
+ /**
406
+ * The active pending replacement, or null when there is none.
407
+ */
335
408
  declare function getPendingReplacement(state: EditorState): PendingReplacement | null;
336
- /** Options for the `startPendingReplacement` command. */
409
+ /**
410
+ * Options for the `startPendingReplacement` command.
411
+ */
337
412
  interface StartPendingReplacementOptions extends PositionRange {
338
413
  mode: PendingReplacementMode;
339
414
  }
340
- /** Options for the `acceptPendingReplacement` command. */
415
+ /**
416
+ * Options for the `acceptPendingReplacement` command.
417
+ */
341
418
  interface AcceptPendingReplacementOptions {
342
- /** Overrides the staged mode for this accept (e.g. "Insert below" on a replace stage). */
419
+ /**
420
+ * Overrides the staged mode for this accept (e.g. "Insert below" on a replace stage).
421
+ */
343
422
  mode?: PendingReplacementMode;
344
423
  }
345
- /** A pending-replacement change: text/range updates, or how the stage ended. */
424
+ /**
425
+ * A pending-replacement change: text/range updates, or how the stage ended.
426
+ */
346
427
  type PendingReplacementEvent = {
347
428
  type: 'update';
348
429
  pending: PendingReplacement;
@@ -378,37 +459,63 @@ interface ReferenceDefinitionIndex {
378
459
  declare function collectReferenceDefinitions(doc: EditorNode): ReferenceDefinitionIndex;
379
460
  //#endregion
380
461
  //#region src/extensions/wiki-embed.d.ts
381
- /** The parsed source payload of an Obsidian-style `![[target]]` embed. */
462
+ /**
463
+ * The parsed source payload of an Obsidian-style `![[target]]` embed.
464
+ */
382
465
  interface ParsedWikiEmbed {
383
- /** Target before an optional alias or size suffix. */
466
+ /**
467
+ * Target before an optional alias or size suffix.
468
+ */
384
469
  target: string;
385
- /** Non-size suffix after `|`, or `''` when absent. */
470
+ /**
471
+ * Non-size suffix after `|`, or `''` when absent.
472
+ */
386
473
  display: string;
387
- /** Requested display width in CSS pixels, or `null`. */
474
+ /**
475
+ * Requested display width in CSS pixels, or `null`.
476
+ */
388
477
  width: number | null;
389
- /** Requested display height in CSS pixels, or `null`. */
478
+ /**
479
+ * Requested display height in CSS pixels, or `null`.
480
+ */
390
481
  height: number | null;
391
482
  }
392
- /** A resolved wiki embed rendered through Meowdown's existing atom views. */
483
+ /**
484
+ * A resolved wiki embed rendered through Meowdown's existing atom views.
485
+ */
393
486
  type WikiEmbedResolution = {
394
487
  kind: 'image';
395
- /** Source passed to `resolveImageUrl` and image click handlers. Defaults to `target`. */
488
+ /**
489
+ * Source passed to `resolveImageUrl` and image click handlers. Defaults to `target`.
490
+ */
396
491
  src?: string;
397
- /** Image alt text. Defaults to the alias or target basename. */
492
+ /**
493
+ * Image alt text. Defaults to the alias or target basename.
494
+ */
398
495
  alt?: string;
399
496
  } | {
400
497
  kind: 'file';
401
- /** Destination passed to file metadata and click handlers. Defaults to `target`. */
498
+ /**
499
+ * Destination passed to file metadata and click handlers. Defaults to `target`.
500
+ */
402
501
  href?: string;
403
- /** File pill label. Defaults to the alias or target basename. */
502
+ /**
503
+ * File pill label. Defaults to the alias or target basename.
504
+ */
404
505
  name?: string;
405
- /** Optional file title. */
506
+ /**
507
+ * Optional file title.
508
+ */
406
509
  title?: string;
407
510
  } | {
408
511
  kind: 'note';
409
- /** Target passed to wikilink click handlers. Defaults to the source target. */
512
+ /**
513
+ * Target passed to wikilink click handlers. Defaults to the source target.
514
+ */
410
515
  target?: string;
411
- /** Chip label. Defaults to the source alias or resolved target. */
516
+ /**
517
+ * Chip label. Defaults to the source alias or resolved target.
518
+ */
412
519
  display?: string;
413
520
  };
414
521
  /**
@@ -417,25 +524,41 @@ type WikiEmbedResolution = {
417
524
  * so it must be pure: the same payload must always return the same result.
418
525
  */
419
526
  type WikiEmbedResolver = (embed: ParsedWikiEmbed) => WikiEmbedResolution | undefined;
420
- /** Host options for wiki-embed parsing. */
527
+ /**
528
+ * Host options for wiki-embed parsing.
529
+ */
421
530
  interface WikiEmbedOptions {
422
531
  resolveWikiEmbed?: WikiEmbedResolver;
423
532
  }
424
- /** Parse `![[target]]`, `![[target|alias]]`, `![[target|width]]`, or `![[target|widthxheight]]`. */
533
+ /**
534
+ * Parse `![[target]]`, `![[target|alias]]`, `![[target|width]]`, or `![[target|widthxheight]]`.
535
+ */
425
536
  declare function parseWikiEmbed(source: string): ParsedWikiEmbed;
426
- /** Rewrite a wiki image embed with a persisted display size. */
537
+ /**
538
+ * Rewrite a wiki image embed with a persisted display size.
539
+ */
427
540
  declare function formatSizedWikiEmbed(target: string, width: number, height: number): string;
428
- /** Last path component of a target, with a note heading/block fragment removed. */
541
+ /**
542
+ * Last path component of a target, with a note heading/block fragment removed.
543
+ */
429
544
  declare function wikiEmbedBasename(target: string): string;
430
545
  //#endregion
431
546
  //#region src/extensions/inline-text-to-mark-chunks.d.ts
432
- /** What {@link FileLinkResolver} sees for one `[label](url)` link. */
547
+ /**
548
+ * What {@link FileLinkResolver} sees for one `[label](url)` link.
549
+ */
433
550
  interface FileLinkPayload {
434
- /** The link destination, exactly as written in the source. */
551
+ /**
552
+ * The link destination, exactly as written in the source.
553
+ */
435
554
  href: string;
436
- /** The raw label slice between the brackets; may be empty or contain nested syntax. */
555
+ /**
556
+ * The raw label slice between the brackets; may be empty or contain nested syntax.
557
+ */
437
558
  label: string;
438
- /** The link title, or `''` when the source has none. */
559
+ /**
560
+ * The link title, or `''` when the source has none.
561
+ */
439
562
  title: string;
440
563
  }
441
564
  /**
@@ -446,7 +569,9 @@ interface FileLinkPayload {
446
569
  * so the same input must always produce the same answer.
447
570
  */
448
571
  type FileLinkResolver = (link: FileLinkPayload) => boolean;
449
- /** Host options that influence inline parsing. */
572
+ /**
573
+ * Host options that influence inline parsing.
574
+ */
450
575
  interface FileLinkOptions {
451
576
  /**
452
577
  * Claim `[label](url)` links as file attachments; see {@link FileLinkResolver}.
@@ -454,14 +579,22 @@ interface FileLinkOptions {
454
579
  */
455
580
  resolveFileLink?: FileLinkResolver;
456
581
  }
457
- /** Host options that influence source-backed inline atom parsing. */
582
+ /**
583
+ * Host options that influence source-backed inline atom parsing.
584
+ */
458
585
  type InlineMarkOptions = FileLinkOptions & WikiEmbedOptions;
459
586
  interface InlineMarkContext {
460
- /** Effective document-wide definitions, keyed by normalized reference label. */
587
+ /**
588
+ * Effective document-wide definitions, keyed by normalized reference label.
589
+ */
461
590
  referenceDefinitions?: ReferenceDefinitions;
462
- /** Prevent this definition block's own label from resolving as a shortcut reference. */
591
+ /**
592
+ * Prevent this definition block's own label from resolving as a shortcut reference.
593
+ */
463
594
  isReferenceDefinition?: boolean;
464
- /** Receives every normalized key read by this block, including unresolved references. */
595
+ /**
596
+ * Receives every normalized key read by this block, including unresolved references.
597
+ */
465
598
  referencedKeys?: Set<string>;
466
599
  }
467
600
  /**
@@ -470,11 +603,17 @@ interface InlineMarkContext {
470
603
  * Callers shift the chunks into the document's coordinate space.
471
604
  */
472
605
  declare function inlineTextToMarkChunks(
473
- /** Typed mark builders bound to the target schema. */
606
+ /**
607
+ * Typed mark builders bound to the target schema.
608
+ */
474
609
  marks: TypedMarkBuilders,
475
- /** The raw inline text of one textblock (no block prefix). */
610
+ /**
611
+ * The raw inline text of one textblock (no block prefix).
612
+ */
476
613
  text: string,
477
- /** Host options; omit for the default parse. */
614
+ /**
615
+ * Host options; omit for the default parse.
616
+ */
478
617
  options?: InlineMarkOptions): MarkChunk[];
479
618
  declare function inlineTextToMarkChunksWithContext(marks: TypedMarkBuilders, text: string, options?: InlineMarkOptions, context?: InlineMarkContext): MarkChunk[];
480
619
  //#endregion
@@ -685,15 +824,23 @@ type TypedEditor = Editor<EditorExtension>;
685
824
  //#region src/extensions/schema.d.ts
686
825
  type TypedNodeBuilders = ExtractNodeBuilders<EditorExtension>;
687
826
  type TypedMarkBuilders = ExtractMarkBuilders<EditorExtension>;
688
- /** Typed mark builders bound to the shared schema. */
827
+ /**
828
+ * Typed mark builders bound to the shared schema.
829
+ */
689
830
  declare const getMarkBuilders: () => TypedMarkBuilders;
690
831
  //#endregion
691
832
  //#region src/converters/md-to-pm.d.ts
692
- /** Options for {@link markdownToDoc}. */
833
+ /**
834
+ * Options for {@link markdownToDoc}.
835
+ */
693
836
  interface MarkdownToDocOptions {
694
- /** Node builders to build the document with. Defaults to the shared schema's builders. */
837
+ /**
838
+ * Node builders to build the document with. Defaults to the shared schema's builders.
839
+ */
695
840
  nodes?: TypedNodeBuilders;
696
- /** Whether to peel a leading `---` frontmatter block onto the doc's `frontmatter` attribute. Off by default. */
841
+ /**
842
+ * Whether to peel a leading `---` frontmatter block onto the doc's `frontmatter` attribute. Off by default.
843
+ */
697
844
  frontmatter?: boolean;
698
845
  }
699
846
  /**
@@ -713,9 +860,13 @@ interface MarkdownToDocOptions {
713
860
  declare function markdownToDoc(markdown: string, options?: MarkdownToDocOptions): ProseMirrorNode;
714
861
  //#endregion
715
862
  //#region src/converters/pm-to-md.d.ts
716
- /** Options for {@link docToMarkdown}. */
863
+ /**
864
+ * Options for {@link docToMarkdown}.
865
+ */
717
866
  interface DocToMarkdownOptions {
718
- /** Whether to serialize the doc's `frontmatter` attribute as a leading `---` block. Off by default. */
867
+ /**
868
+ * Whether to serialize the doc's `frontmatter` attribute as a leading `---` block. Off by default.
869
+ */
719
870
  frontmatter?: boolean;
720
871
  }
721
872
  /**
@@ -751,7 +902,9 @@ declare function defineBulletAfterHeading(): PlainExtension;
751
902
  * `tok-*` classes; the default theme colors them per color scheme.
752
903
  */
753
904
  declare function defineCodeBlockSyntaxHighlight(): Extension;
754
- /** A highlighted span of code: `[from, to)` carries the `@lezer/highlight` classes. */
905
+ /**
906
+ * A highlighted span of code: `[from, to)` carries the `@lezer/highlight` classes.
907
+ */
755
908
  type CodeToken = readonly [from: number, to: number, classes: string];
756
909
  /**
757
910
  * Highlight `code` in `language` into `tok-*` token spans, the same classes the
@@ -794,17 +947,29 @@ interface EmbedDescriptor {
794
947
  * keys the React element, so the embed never reloads.
795
948
  */
796
949
  readonly key: string;
797
- /** The iframe `src`. */
950
+ /**
951
+ * The iframe `src`.
952
+ */
798
953
  readonly src: string;
799
- /** The iframe `title`. */
954
+ /**
955
+ * The iframe `title`.
956
+ */
800
957
  readonly title: string;
801
- /** The iframe `class`, e.g. `md-embed md-embed-tweet`. */
958
+ /**
959
+ * The iframe `class`, e.g. `md-embed md-embed-tweet`.
960
+ */
802
961
  readonly className: string;
803
- /** The iframe `data-testid`. */
962
+ /**
963
+ * The iframe `data-testid`.
964
+ */
804
965
  readonly testid: string;
805
- /** The iframe `allow` policy, when the embed needs one. */
966
+ /**
967
+ * The iframe `allow` policy, when the embed needs one.
968
+ */
806
969
  readonly allow?: string;
807
- /** Whether the iframe is fullscreen-capable. */
970
+ /**
971
+ * Whether the iframe is fullscreen-capable.
972
+ */
808
973
  readonly allowFullscreen?: boolean;
809
974
  }
810
975
  //#endregion
@@ -819,15 +984,23 @@ interface EmbedDescriptor {
819
984
  declare function listenForTweetHeight(iframe: HTMLIFrameElement, onHeight?: (height: number) => void): () => void;
820
985
  //#endregion
821
986
  //#region src/extensions/embed.d.ts
822
- /** Detect a tweet/YouTube embed in an image `src`, or `undefined` for a plain image. */
987
+ /**
988
+ * Detect a tweet/YouTube embed in an image `src`, or `undefined` for a plain image.
989
+ */
823
990
  declare function matchEmbed(src: string): EmbedDescriptor | undefined;
824
991
  //#endregion
825
992
  //#region src/extensions/exit-boundary.d.ts
826
- /** Payload for {@link ExitBoundaryHandler}. */
993
+ /**
994
+ * Payload for {@link ExitBoundaryHandler}.
995
+ */
827
996
  interface ExitBoundaryOptions {
828
- /** The boundary the caret would leave: `up` at the document start, `down` at the end. */
997
+ /**
998
+ * The boundary the caret would leave: `up` at the document start, `down` at the end.
999
+ */
829
1000
  direction: 'up' | 'down';
830
- /** The originating arrow key press. */
1001
+ /**
1002
+ * The originating arrow key press.
1003
+ */
831
1004
  event: KeyboardEvent;
832
1005
  }
833
1006
  /**
@@ -836,15 +1009,23 @@ interface ExitBoundaryOptions {
836
1009
  * other return value consumes it.
837
1010
  */
838
1011
  type ExitBoundaryHandler = (options: ExitBoundaryOptions) => boolean | void;
839
- /** Call `onExitBoundary` when an arrow key press would leave the document boundary. */
1012
+ /**
1013
+ * Call `onExitBoundary` when an arrow key press would leave the document boundary.
1014
+ */
840
1015
  declare function defineExitBoundaryHandler(onExitBoundary: ExitBoundaryHandler): PlainExtension;
841
1016
  //#endregion
842
1017
  //#region src/extensions/file-click.d.ts
843
- /** Payload for {@link FileClickHandler}. */
1018
+ /**
1019
+ * Payload for {@link FileClickHandler}.
1020
+ */
844
1021
  interface FileClickPayload {
845
- /** The resolved destination from `[name](href)` or a claimed `![[target]]`. */
1022
+ /**
1023
+ * The resolved destination from `[name](href)` or a claimed `![[target]]`.
1024
+ */
846
1025
  href: string;
847
- /** The file name shown on the pill. */
1026
+ /**
1027
+ * The file name shown on the pill.
1028
+ */
848
1029
  name: string;
849
1030
  /**
850
1031
  * The originating click, or the `Enter`/`Mod-Enter` key press that followed the
@@ -863,7 +1044,9 @@ declare function defineFileClickHandler(onClick: FileClickHandler): PlainExtensi
863
1044
  //#region src/extensions/file-paste.d.ts
864
1045
  type FilePasteHandler = (file: File) => string | undefined | Promise<string | undefined>;
865
1046
  type FileSaveErrorHandler = (error: unknown, file: File) => void;
866
- /** Options for {@link defineFilePaste}. */
1047
+ /**
1048
+ * Options for {@link defineFilePaste}.
1049
+ */
867
1050
  interface FilePasteOptions {
868
1051
  /**
869
1052
  * Persist a pasted/dropped file and return its markdown destination, or
@@ -872,7 +1055,9 @@ interface FilePasteOptions {
872
1055
  * inserts `![](src)`; any other file inserts a `[name](src)` link.
873
1056
  */
874
1057
  onFilePaste?: FilePasteHandler;
875
- /** Called when persisting a pasted/dropped file throws. Defaults to `console.error`. */
1058
+ /**
1059
+ * Called when persisting a pasted/dropped file throws. Defaults to `console.error`.
1060
+ */
876
1061
  onFileSaveError?: FileSaveErrorHandler;
877
1062
  }
878
1063
  /**
@@ -894,9 +1079,13 @@ declare function buildFileMarkdown(file: {
894
1079
  declare function defineFilePaste(options?: FilePasteOptions): PlainExtension;
895
1080
  //#endregion
896
1081
  //#region src/extensions/file-view.d.ts
897
- /** Metadata a host resolves for one file link, shown on its pill. */
1082
+ /**
1083
+ * Metadata a host resolves for one file link, shown on its pill.
1084
+ */
898
1085
  interface FileInfo {
899
- /** File size in bytes, shown as a human-readable suffix (e.g. `1.4 MB`). */
1086
+ /**
1087
+ * File size in bytes, shown as a human-readable suffix (e.g. `1.4 MB`).
1088
+ */
900
1089
  size?: number;
901
1090
  }
902
1091
  /**
@@ -907,12 +1096,18 @@ interface FileInfo {
907
1096
  * resolve repeatedly: cache in the host when resolving is expensive.
908
1097
  */
909
1098
  type FileInfoResolver = (href: string) => FileInfo | undefined | Promise<FileInfo | undefined>;
910
- /** Options for {@link defineFileView}. */
1099
+ /**
1100
+ * Options for {@link defineFileView}.
1101
+ */
911
1102
  interface FileViewOptions {
912
- /** Resolve the metadata (file size) shown on a pill. Omit to show none. */
1103
+ /**
1104
+ * Resolve the metadata (file size) shown on a pill. Omit to show none.
1105
+ */
913
1106
  resolveFileInfo?: FileInfoResolver;
914
1107
  }
915
- /** Classify a file destination for the pill's `data-file-kind` attribute. */
1108
+ /**
1109
+ * Classify a file destination for the pill's `data-file-kind` attribute.
1110
+ */
916
1111
  declare function getFileKind(href: string): string;
917
1112
  /**
918
1113
  * Render a claimed file link or wiki embed (the `mdFile` mark) as an inline
@@ -925,7 +1120,9 @@ declare function defineFileView(options?: FileViewOptions): PlainExtension;
925
1120
  //#region src/extensions/link-click.d.ts
926
1121
  interface LinkClickPayload {
927
1122
  href: string;
928
- /** The originating click, or the `Enter`/`Mod-Enter` key press that followed the link. */
1123
+ /**
1124
+ * The originating click, or the `Enter`/`Mod-Enter` key press that followed the link.
1125
+ */
929
1126
  event: MouseEvent | KeyboardEvent;
930
1127
  }
931
1128
  type LinkClickHandler = (payload: LinkClickPayload) => void;
@@ -942,7 +1139,9 @@ declare function defineLinkClickHandler(onClick: LinkClickHandler): PlainExtensi
942
1139
  //#endregion
943
1140
  //#region src/extensions/tag-click.d.ts
944
1141
  interface TagClickPayload {
945
- /** The tag name, without the leading `#`. */
1142
+ /**
1143
+ * The tag name, without the leading `#`.
1144
+ */
946
1145
  tag: string;
947
1146
  /**
948
1147
  * The originating click, or the `Enter`/`Mod-Enter` key press that followed the tag.
@@ -966,7 +1165,9 @@ interface WikilinkHit {
966
1165
  }
967
1166
  interface WikilinkClickPayload {
968
1167
  target: string;
969
- /** The originating click, or the `Enter`/`Mod-Enter` key press that followed the link. */
1168
+ /**
1169
+ * The originating click, or the `Enter`/`Mod-Enter` key press that followed the link.
1170
+ */
970
1171
  event: MouseEvent | KeyboardEvent;
971
1172
  }
972
1173
  type WikilinkClickHandler = (payload: WikilinkClickPayload) => void;
@@ -995,11 +1196,17 @@ interface FollowLinkHandlers {
995
1196
  declare function defineFollowLinkHandler(handlers: FollowLinkHandlers): PlainExtension;
996
1197
  //#endregion
997
1198
  //#region src/extensions/image-click.d.ts
998
- /** Payload for {@link ImageClickHandler}. */
1199
+ /**
1200
+ * Payload for {@link ImageClickHandler}.
1201
+ */
999
1202
  interface ImageClickPayload {
1000
- /** The resolved source from `![alt](src)` or a claimed `![[target]]`. */
1203
+ /**
1204
+ * The resolved source from `![alt](src)` or a claimed `![[target]]`.
1205
+ */
1001
1206
  src: string;
1002
- /** The image alt text. */
1207
+ /**
1208
+ * The image alt text.
1209
+ */
1003
1210
  alt: string;
1004
1211
  /**
1005
1212
  * The originating click or touch tap. Read the target or position a popover
@@ -1023,7 +1230,9 @@ declare function defineImageClickHandler(onClick: ImageClickHandler): PlainExten
1023
1230
  //#endregion
1024
1231
  //#region src/extensions/image.d.ts
1025
1232
  type ImageUrlResolver = (src: string) => string | undefined;
1026
- /** Options for {@link defineImage}. */
1233
+ /**
1234
+ * Options for {@link defineImage}.
1235
+ */
1027
1236
  interface ImageOptions {
1028
1237
  /**
1029
1238
  * Map a markdown `src` to a displayable URL, or `undefined` to skip rendering
@@ -1038,7 +1247,9 @@ interface ImageOptions {
1038
1247
  */
1039
1248
  persistTweetHeight?: boolean;
1040
1249
  }
1041
- /** Show an `src` as-is when it is an http(s) URL, otherwise skip rendering it. */
1250
+ /**
1251
+ * Show an `src` as-is when it is an http(s) URL, otherwise skip rendering it.
1252
+ */
1042
1253
  declare function defaultResolveImageUrl(src: string): string | undefined;
1043
1254
  /**
1044
1255
  * Inline image/embed rendering: a mark view on the `mdImage` mark. Images
@@ -1050,7 +1261,9 @@ declare function defaultResolveImageUrl(src: string): string | undefined;
1050
1261
  declare function defineImage(options?: ImageOptions): PlainExtension;
1051
1262
  //#endregion
1052
1263
  //#region src/extensions/key-bindings.d.ts
1053
- /** Human-readable descriptions of the editor's formatting and heading shortcuts. */
1264
+ /**
1265
+ * Human-readable descriptions of the editor's formatting and heading shortcuts.
1266
+ */
1054
1267
  declare const EDITOR_KEY_BINDINGS: {
1055
1268
  readonly 'Mod-b': "Bold";
1056
1269
  readonly 'Mod-i': "Italic";
@@ -1112,7 +1325,9 @@ type MarkName = (typeof MARK_NAMES)[number];
1112
1325
  declare function isMarkOfType(mark: Mark, name: MarkName): boolean;
1113
1326
  //#endregion
1114
1327
  //#region src/extensions/math.d.ts
1115
- /** Inline math rendering: a KaTeX preview on the `mdMath` mark. */
1328
+ /**
1329
+ * Inline math rendering: a KaTeX preview on the `mdMath` mark.
1330
+ */
1116
1331
  declare function defineMath(): PlainExtension;
1117
1332
  //#endregion
1118
1333
  //#region src/extensions/node-names.d.ts
@@ -1127,7 +1342,9 @@ declare function isNodeOfType(node: ProseMirrorNode, name: NodeName): boolean;
1127
1342
  declare function defineSpellCheckPlugin(spellCheck: boolean): PlainExtension;
1128
1343
  //#endregion
1129
1344
  //#region src/extensions/substitution.d.ts
1130
- /** Apply the editor's automatic plain-text substitutions. */
1345
+ /**
1346
+ * Apply the editor's automatic plain-text substitutions.
1347
+ */
1131
1348
  declare function defineSubstitution(): PlainExtension;
1132
1349
  //#endregion
1133
1350
  //#region src/extensions/table.d.ts
@@ -1169,12 +1386,18 @@ declare function defineViewAttributes(attributes: {
1169
1386
  declare function defineVirtualCaret(layer: HTMLElement): PlainExtension;
1170
1387
  //#endregion
1171
1388
  //#region src/extensions/wikilink-hover.d.ts
1172
- /** A wikilink currently under the pointer. */
1389
+ /**
1390
+ * A wikilink currently under the pointer.
1391
+ */
1173
1392
  interface WikilinkHoverHit extends WikilinkHit {
1174
- /** The rendered wikilink label used as the popup anchor. */
1393
+ /**
1394
+ * The rendered wikilink label used as the popup anchor.
1395
+ */
1175
1396
  element: HTMLElement;
1176
1397
  }
1177
- /** Called once on wikilink enter and with `undefined` on leave or invalidation. */
1398
+ /**
1399
+ * Called once on wikilink enter and with `undefined` on leave or invalidation.
1400
+ */
1178
1401
  type WikilinkHoverHandler = (hit: WikilinkHoverHit | undefined) => void;
1179
1402
  /**
1180
1403
  * Track the wikilink under the pointer without attaching per-link listeners.