@meowdown/core 0.65.3 → 0.65.4

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.
package/dist/index.d.ts CHANGED
@@ -16,8 +16,8 @@ import { VirtualElement } from "@floating-ui/dom";
16
16
  * - `exact`: byte-identical (modulo the trailing newline).
17
17
  * - `normalizing`: bytes differ, but only as layout the parser reads back
18
18
  * through - every content line survives and the output re-parses to the same
19
- * document (e.g. a lazy continuation re-indented to its canonical column, or
20
- * a table delimiter row rewritten to canonical dashes).
19
+ * document (e.g. a lazy continuation re-indented, or `>>>>>>> x` respaced to
20
+ * the seven blockquotes it already meant).
21
21
  * - `lossy`: content changed - a content line differs or disappeared, or the
22
22
  * output re-parses to a different document.
23
23
  */
@@ -34,7 +34,7 @@ interface CheckRoundTripOptions {
34
34
  /**
35
35
  * Classify how `markdown` survives the editor's parse-then-serialize round trip.
36
36
  */
37
- declare function checkRoundTrip(markdown: string, options?: CheckRoundTripOptions): RoundTripFidelity;
37
+ export declare function checkRoundTrip(markdown: string, options?: CheckRoundTripOptions): RoundTripFidelity;
38
38
  //#endregion
39
39
  //#region src/extensions/frontmatter.d.ts
40
40
  /**
@@ -100,7 +100,7 @@ type TableHeaderCellAlignExtension = Extension<{
100
100
  * undefined when the selection is outside a table or the column has no
101
101
  * alignment.
102
102
  */
103
- declare function getTableColumnAlign(state: EditorState): TableColumnAlign | undefined;
103
+ export declare function getTableColumnAlign(state: EditorState): TableColumnAlign | undefined;
104
104
  type TableColumnAlignCommandsExtension = Extension<{
105
105
  Commands: {
106
106
  setTableColumnAlign: [align: TableColumnAlign | null];
@@ -174,7 +174,7 @@ type HTMLCommentExtension = Extension<{
174
174
  * The node is `atom` (no editable content) and not selectable: it is an opaque,
175
175
  * invisible marker the cursor steps over rather than a block the user edits.
176
176
  */
177
- declare function defineHTMLComment(): HTMLCommentExtension;
177
+ export declare function defineHTMLComment(): HTMLCommentExtension;
178
178
  //#endregion
179
179
  //#region src/extensions/inline-marks.d.ts
180
180
  /**
@@ -358,7 +358,7 @@ type LinkUnit = (LinkUnitBase & {
358
358
  * `mdPack` unit gives the shape and carries the `href`/`title` in its `data`, and
359
359
  * the `mdLinkUri` run locates the `( )` body.
360
360
  */
361
- declare function getLinkUnitAt(state: EditorState, pos: number): LinkUnit | undefined;
361
+ export declare function getLinkUnitAt(state: EditorState, pos: number): LinkUnit | undefined;
362
362
  //#endregion
363
363
  //#region src/extensions/link-commands.d.ts
364
364
  interface LinkAttrs {
@@ -370,16 +370,16 @@ interface InsertLinkOptions {
370
370
  title?: string;
371
371
  wrapText?: boolean;
372
372
  }
373
- declare function insertLink({ href, title, wrapText }?: InsertLinkOptions): Command;
373
+ export declare function insertLink({ href, title, wrapText }?: InsertLinkOptions): Command;
374
374
  /**
375
375
  * Rewrite the `( ... )` of the link at the caret/selection.
376
376
  */
377
- declare function updateLink(attrs: LinkAttrs): Command;
377
+ export declare function updateLink(attrs: LinkAttrs): Command;
378
378
  /**
379
379
  * Unwrap the link at the caret: keep the label text, drop the syntax.
380
380
  */
381
- declare function removeLink(): Command;
382
- declare function defineLinkCommands(): Extension<{
381
+ export declare function removeLink(): Command;
382
+ export declare function defineLinkCommands(): Extension<{
383
383
  Commands: {
384
384
  insertLink: [options?: InsertLinkOptions];
385
385
  updateLink: [attrs: LinkAttrs];
@@ -392,7 +392,7 @@ interface LinkEditOptions {
392
392
  link: LinkUnit | undefined;
393
393
  }
394
394
  type LinkEditHandler = (options: LinkEditOptions) => void;
395
- declare function defineLinkEditKeymap(onLinkEdit: LinkEditHandler): PlainExtension;
395
+ export declare function defineLinkEditKeymap(onLinkEdit: LinkEditHandler): PlainExtension;
396
396
  //#endregion
397
397
  //#region src/extensions/pending-replacement.d.ts
398
398
  /**
@@ -429,7 +429,7 @@ interface PendingReplacement {
429
429
  /**
430
430
  * The active pending replacement, or null when there is none.
431
431
  */
432
- declare function getPendingReplacement(state: EditorState): PendingReplacement | null;
432
+ export declare function getPendingReplacement(state: EditorState): PendingReplacement | null;
433
433
  /**
434
434
  * Options for the `startPendingReplacement` command.
435
435
  */
@@ -461,7 +461,7 @@ type PendingReplacementHandler = (event: PendingReplacementEvent) => void;
461
461
  * Watches pending-replacement state and reports changes, so a UI layer can
462
462
  * render the preview and know whether the stage was accepted or discarded.
463
463
  */
464
- declare function definePendingReplacementHandler(handler: PendingReplacementHandler): PlainExtension;
464
+ export declare function definePendingReplacementHandler(handler: PendingReplacementHandler): PlainExtension;
465
465
  //#endregion
466
466
  //#region src/extensions/mark-chunk.d.ts
467
467
  /**
@@ -480,7 +480,7 @@ interface ReferenceDefinitionIndex {
480
480
  definitions: ReferenceDefinitions;
481
481
  nodes: ReadonlySet<EditorNode>;
482
482
  }
483
- declare function collectReferenceDefinitions(doc: EditorNode): ReferenceDefinitionIndex;
483
+ export declare function collectReferenceDefinitions(doc: EditorNode): ReferenceDefinitionIndex;
484
484
  //#endregion
485
485
  //#region src/extensions/wiki-embed.d.ts
486
486
  /**
@@ -557,15 +557,15 @@ interface WikiEmbedOptions {
557
557
  /**
558
558
  * Parse `![[target]]`, `![[target|alias]]`, `![[target|width]]`, or `![[target|widthxheight]]`.
559
559
  */
560
- declare function parseWikiEmbed(source: string): ParsedWikiEmbed;
560
+ export declare function parseWikiEmbed(source: string): ParsedWikiEmbed;
561
561
  /**
562
562
  * Rewrite a wiki image embed with a persisted display size.
563
563
  */
564
- declare function formatSizedWikiEmbed(target: string, width: number, height: number): string;
564
+ export declare function formatSizedWikiEmbed(target: string, width: number, height: number): string;
565
565
  /**
566
566
  * Last path component of a target, with a note heading/block fragment removed.
567
567
  */
568
- declare function wikiEmbedBasename(target: string): string;
568
+ export declare function wikiEmbedBasename(target: string): string;
569
569
  //#endregion
570
570
  //#region src/extensions/inline-text-to-mark-chunks.d.ts
571
571
  /**
@@ -626,7 +626,7 @@ interface InlineMarkContext {
626
626
  * with positions relative to the start of `text` (i.e. zero-based).
627
627
  * Callers shift the chunks into the document's coordinate space.
628
628
  */
629
- declare function inlineTextToMarkChunks(
629
+ export declare function inlineTextToMarkChunks(
630
630
  /**
631
631
  * Typed mark builders bound to the target schema.
632
632
  */
@@ -639,7 +639,7 @@ text: string,
639
639
  * Host options; omit for the default parse.
640
640
  */
641
641
  options?: InlineMarkOptions): MarkChunk[];
642
- declare function inlineTextToMarkChunksWithContext(marks: TypedMarkBuilders, text: string, options?: InlineMarkOptions, context?: InlineMarkContext): MarkChunk[];
642
+ export declare function inlineTextToMarkChunksWithContext(marks: TypedMarkBuilders, text: string, options?: InlineMarkOptions, context?: InlineMarkContext): MarkChunk[];
643
643
  //#endregion
644
644
  //#region src/extensions/mark-mode.d.ts
645
645
  /**
@@ -842,7 +842,7 @@ type EditorExtensionOptions = InlineMarkOptions & {
842
842
  */
843
843
  markMode?: MarkMode;
844
844
  };
845
- declare function defineEditorExtension(options?: EditorExtensionOptions): EditorExtension;
845
+ export declare function defineEditorExtension(options?: EditorExtensionOptions): EditorExtension;
846
846
  type TypedEditor = Editor<EditorExtension>;
847
847
  //#endregion
848
848
  //#region src/extensions/schema.d.ts
@@ -851,7 +851,7 @@ type TypedMarkBuilders = ExtractMarkBuilders<EditorExtension>;
851
851
  /**
852
852
  * Typed mark builders bound to the shared schema.
853
853
  */
854
- declare const getMarkBuilders: () => TypedMarkBuilders;
854
+ export declare const getMarkBuilders: () => TypedMarkBuilders;
855
855
  //#endregion
856
856
  //#region src/converters/md-to-pm.d.ts
857
857
  /**
@@ -881,7 +881,7 @@ interface MarkdownToDocOptions {
881
881
  * inline marks because the markdown stays literal text - emphasis / link /
882
882
  * inline-code characters survive verbatim.
883
883
  */
884
- declare function markdownToDoc(markdown: string, options?: MarkdownToDocOptions): ProseMirrorNode;
884
+ export declare function markdownToDoc(markdown: string, options?: MarkdownToDocOptions): ProseMirrorNode;
885
885
  //#endregion
886
886
  //#region src/converters/pm-to-md.d.ts
887
887
  /**
@@ -908,7 +908,7 @@ interface DocToMarkdownOptions {
908
908
  * - Backtick fence width and cell escaping use single linear loops, no
909
909
  * regex on the hot path.
910
910
  */
911
- declare function docToMarkdown(node: ProseMirrorNode, options?: DocToMarkdownOptions): string;
911
+ export declare function docToMarkdown(node: ProseMirrorNode, options?: DocToMarkdownOptions): string;
912
912
  //#endregion
913
913
  //#region src/extensions/bullet-after-heading.d.ts
914
914
  /**
@@ -916,7 +916,7 @@ declare function docToMarkdown(node: ProseMirrorNode, options?: DocToMarkdownOpt
916
916
  * pressing Enter at the end of the document's first heading (the title line)
917
917
  * drops the caret into a fresh empty bullet instead of a plain paragraph.
918
918
  */
919
- declare function defineBulletAfterHeading(): PlainExtension;
919
+ export declare function defineBulletAfterHeading(): PlainExtension;
920
920
  //#endregion
921
921
  //#region src/extensions/code-block-highlight.d.ts
922
922
  /**
@@ -925,7 +925,7 @@ declare function defineBulletAfterHeading(): PlainExtension;
925
925
  * `@codemirror/language-data`). Tokens are tagged with `@lezer/highlight`
926
926
  * `tok-*` classes; the default theme colors them per color scheme.
927
927
  */
928
- declare function defineCodeBlockSyntaxHighlight(): Extension;
928
+ export declare function defineCodeBlockSyntaxHighlight(): Extension;
929
929
  /**
930
930
  * A highlighted span of code: `[from, to)` carries the `@lezer/highlight` classes.
931
931
  */
@@ -936,7 +936,7 @@ type CodeToken = readonly [from: number, to: number, classes: string];
936
936
  * loaded (the common path, no render flash), and a `Promise` only when a grammar
937
937
  * must load on demand. Returns `[]` for an empty or unsupported language.
938
938
  */
939
- declare function getCodeTokens(code: string, language: string): CodeToken[] | Promise<CodeToken[]>;
939
+ export declare function getCodeTokens(code: string, language: string): CodeToken[] | Promise<CodeToken[]>;
940
940
  //#endregion
941
941
  //#region src/extensions/code-block-languages.d.ts
942
942
  type LanguageItem = {
@@ -946,7 +946,7 @@ type LanguageItem = {
946
946
  /**
947
947
  * A list of languages for code block syntax-highlight.
948
948
  */
949
- declare const codeBlockLanguages: ReadonlyArray<LanguageItem>;
949
+ export declare const codeBlockLanguages: ReadonlyArray<LanguageItem>;
950
950
  //#endregion
951
951
  //#region src/extensions/embed-paste.d.ts
952
952
  /**
@@ -955,7 +955,7 @@ declare const codeBlockLanguages: ReadonlyArray<LanguageItem>;
955
955
  * renders as a rich embed. Not part of `defineEditorExtension`; the React
956
956
  * package applies it via the `embedPaste` prop (on by default).
957
957
  */
958
- declare function defineEmbedPaste(): PlainExtension;
958
+ export declare function defineEmbedPaste(): PlainExtension;
959
959
  //#endregion
960
960
  //#region src/extensions/embed-types.d.ts
961
961
  /**
@@ -1005,13 +1005,13 @@ interface EmbedDescriptor {
1005
1005
  * the editor's DOM mark view (which has no destroy hook) is covered, while a
1006
1006
  * React caller can call it on unmount.
1007
1007
  */
1008
- declare function listenForTweetHeight(iframe: HTMLIFrameElement, onHeight?: (height: number) => void): () => void;
1008
+ export declare function listenForTweetHeight(iframe: HTMLIFrameElement, onHeight?: (height: number) => void): () => void;
1009
1009
  //#endregion
1010
1010
  //#region src/extensions/embed.d.ts
1011
1011
  /**
1012
1012
  * Detect a tweet/YouTube embed in an image `src`, or `undefined` for a plain image.
1013
1013
  */
1014
- declare function matchEmbed(src: string): EmbedDescriptor | undefined;
1014
+ export declare function matchEmbed(src: string): EmbedDescriptor | undefined;
1015
1015
  //#endregion
1016
1016
  //#region src/extensions/exit-boundary.d.ts
1017
1017
  /**
@@ -1036,7 +1036,7 @@ type ExitBoundaryHandler = (options: ExitBoundaryOptions) => boolean | void;
1036
1036
  /**
1037
1037
  * Call `onExitBoundary` when an arrow key press would leave the document boundary.
1038
1038
  */
1039
- declare function defineExitBoundaryHandler(onExitBoundary: ExitBoundaryHandler): PlainExtension;
1039
+ export declare function defineExitBoundaryHandler(onExitBoundary: ExitBoundaryHandler): PlainExtension;
1040
1040
  //#endregion
1041
1041
  //#region src/extensions/file-click.d.ts
1042
1042
  /**
@@ -1068,7 +1068,7 @@ type FileClickHandler = (payload: FileClickPayload) => void;
1068
1068
  * `href`, `name`, and the originating `MouseEvent`. The host decides what a
1069
1069
  * click does (e.g. open the file in the OS default app).
1070
1070
  */
1071
- declare function defineFileClickHandler(onClick: FileClickHandler): PlainExtension;
1071
+ export declare function defineFileClickHandler(onClick: FileClickHandler): PlainExtension;
1072
1072
  //#endregion
1073
1073
  //#region src/extensions/file-paste.d.ts
1074
1074
  type FilePasteHandler = (file: File) => string | undefined | Promise<string | undefined>;
@@ -1096,7 +1096,7 @@ interface FilePasteOptions {
1096
1096
  * name. Exported so a host command that inserts file links itself (e.g. an
1097
1097
  * attach-file picker) produces markdown byte-identical to a paste/drop.
1098
1098
  */
1099
- declare function buildFileMarkdown(file: {
1099
+ export declare function buildFileMarkdown(file: {
1100
1100
  name: string;
1101
1101
  type?: string;
1102
1102
  }, destination: string): string;
@@ -1105,7 +1105,7 @@ declare function buildFileMarkdown(file: {
1105
1105
  * markdown destination: `![](src)` for an image, a `[name](src)` link for any
1106
1106
  * other file. Multiple files insert one link per line, in DataTransfer order.
1107
1107
  */
1108
- declare function defineFilePaste(options?: FilePasteOptions): PlainExtension;
1108
+ export declare function defineFilePaste(options?: FilePasteOptions): PlainExtension;
1109
1109
  //#endregion
1110
1110
  //#region src/extensions/file-view.d.ts
1111
1111
  /**
@@ -1137,14 +1137,14 @@ interface FileViewOptions {
1137
1137
  /**
1138
1138
  * Classify a file destination for the pill's `data-file-kind` attribute.
1139
1139
  */
1140
- declare function getFileKind(href: string): string;
1140
+ export declare function getFileKind(href: string): string;
1141
1141
  /**
1142
1142
  * Render a claimed file link or wiki embed (the `mdFile` mark) as an inline
1143
1143
  * pill: a file-kind icon, the file name, and the size once
1144
1144
  * `resolveFileInfo` supplies it. The pill never loads the file's content;
1145
1145
  * clicks are reported through `defineFileClickHandler`.
1146
1146
  */
1147
- declare function defineFileView(options?: FileViewOptions): PlainExtension;
1147
+ export declare function defineFileView(options?: FileViewOptions): PlainExtension;
1148
1148
  //#endregion
1149
1149
  //#region src/extensions/image-click.d.ts
1150
1150
  /**
@@ -1183,7 +1183,7 @@ type ImageClickHandler = (payload: ImageClickPayload) => void;
1183
1183
  * raises the software keyboard before the handler opens its own surface
1184
1184
  * (such as a lightbox).
1185
1185
  */
1186
- declare function defineImageClickHandler(onClick: ImageClickHandler): PlainExtension;
1186
+ export declare function defineImageClickHandler(onClick: ImageClickHandler): PlainExtension;
1187
1187
  //#endregion
1188
1188
  //#region src/extensions/link-click.d.ts
1189
1189
  interface LinkClickPayload {
@@ -1208,7 +1208,7 @@ type LinkCopyHandler = (payload: LinkCopyPayload) => void;
1208
1208
  * (`[text](url)`), or presses `Mod-Enter` with the caret on one. The `event`
1209
1209
  * is the originating `MouseEvent` or `KeyboardEvent`.
1210
1210
  */
1211
- declare function defineLinkClickHandler(onClick: LinkClickHandler): PlainExtension;
1211
+ export declare function defineLinkClickHandler(onClick: LinkClickHandler): PlainExtension;
1212
1212
  //#endregion
1213
1213
  //#region src/extensions/tag-click.d.ts
1214
1214
  interface TagClickPayload {
@@ -1233,7 +1233,7 @@ type TagClickHandler = (payload: TagClickPayload) => void;
1233
1233
  * `Mod-Enter` with the caret on one. The `tag` is read from the rendered text
1234
1234
  * without the leading `#`.
1235
1235
  */
1236
- declare function defineTagClickHandler(onClick: TagClickHandler): PlainExtension;
1236
+ export declare function defineTagClickHandler(onClick: TagClickHandler): PlainExtension;
1237
1237
  //#endregion
1238
1238
  //#region src/extensions/wikilink-click.d.ts
1239
1239
  interface WikilinkHit {
@@ -1259,7 +1259,7 @@ type WikilinkClickHandler = (payload: WikilinkClickPayload) => void;
1259
1259
  * `Mod-Enter` with the caret on one. The `event` is the originating
1260
1260
  * `MouseEvent` or `KeyboardEvent`.
1261
1261
  */
1262
- declare function defineWikilinkClickHandler(onClick: WikilinkClickHandler): PlainExtension;
1262
+ export declare function defineWikilinkClickHandler(onClick: WikilinkClickHandler): PlainExtension;
1263
1263
  //#endregion
1264
1264
  //#region src/extensions/follow-link.d.ts
1265
1265
  interface FollowLinkHandlers {
@@ -1284,7 +1284,7 @@ interface FollowLinkHandlers {
1284
1284
  * a caret follow always reports `mod: false`, its mod key being the trigger
1285
1285
  * itself.
1286
1286
  */
1287
- declare function defineFollowLinkHandler(handlers: FollowLinkHandlers): PlainExtension;
1287
+ export declare function defineFollowLinkHandler(handlers: FollowLinkHandlers): PlainExtension;
1288
1288
  //#endregion
1289
1289
  //#region src/extensions/image.d.ts
1290
1290
  type ImageUrlResolver = (src: string) => string | undefined;
@@ -1308,7 +1308,7 @@ interface ImageOptions {
1308
1308
  /**
1309
1309
  * Show an `src` as-is when it is an http(s) URL, otherwise skip rendering it.
1310
1310
  */
1311
- declare function defaultResolveImageUrl(src: string): string | undefined;
1311
+ export declare function defaultResolveImageUrl(src: string): string | undefined;
1312
1312
  /**
1313
1313
  * Inline image/embed rendering: a mark view on the `mdImage` mark. Images
1314
1314
  * render in place from their literal Markdown source. Drag a rendered image's
@@ -1316,13 +1316,13 @@ declare function defaultResolveImageUrl(src: string): string | undefined;
1316
1316
  * `![alt](src)<!-- {"width":320,"height":240} -->`, which round-trips as
1317
1317
  * plain Markdown.
1318
1318
  */
1319
- declare function defineImage(options?: ImageOptions): PlainExtension;
1319
+ export declare function defineImage(options?: ImageOptions): PlainExtension;
1320
1320
  //#endregion
1321
1321
  //#region src/extensions/key-bindings.d.ts
1322
1322
  /**
1323
1323
  * Human-readable descriptions of the editor's formatting and heading shortcuts.
1324
1324
  */
1325
- declare const EDITOR_KEY_BINDINGS: {
1325
+ export declare const EDITOR_KEY_BINDINGS: {
1326
1326
  readonly 'Mod-b': "Bold";
1327
1327
  readonly 'Mod-i': "Italic";
1328
1328
  readonly 'Mod-e': "Inline code";
@@ -1359,7 +1359,7 @@ interface MarkHoverHit<Payload> {
1359
1359
  //#endregion
1360
1360
  //#region src/extensions/link-hover.d.ts
1361
1361
  type LinkHoverHandler = (hit: MarkHoverHit<LinkUnit> | undefined) => void;
1362
- declare function defineLinkHoverHandler(onHoverChange: LinkHoverHandler): PlainExtension;
1362
+ export declare function defineLinkHoverHandler(onHoverChange: LinkHoverHandler): PlainExtension;
1363
1363
  //#endregion
1364
1364
  //#region src/extensions/link-paste.d.ts
1365
1365
  /**
@@ -1375,18 +1375,18 @@ declare function defineLinkHoverHandler(onHoverChange: LinkHoverHandler): PlainE
1375
1375
  * embed. Not part of `defineEditorExtension`; the React package applies it via
1376
1376
  * the `linkPaste` prop (on by default).
1377
1377
  */
1378
- declare function defineLinkPaste(): PlainExtension;
1378
+ export declare function defineLinkPaste(): PlainExtension;
1379
1379
  //#endregion
1380
1380
  //#region src/extensions/mark-names.d.ts
1381
1381
  declare const MARK_NAMES: readonly ["mdWikilink", "mdImage", "mdFile", "mdMath", "mdMark", "mdEm", "mdStrong", "mdCode", "mdLinkText", "mdLinkUri", "mdLinkTitle", "mdDel", "mdHighlight", "mdTag", "mdPack"];
1382
1382
  type MarkName = (typeof MARK_NAMES)[number];
1383
- declare function isMarkOfType(mark: Mark, name: MarkName): boolean;
1383
+ export declare function isMarkOfType(mark: Mark, name: MarkName): boolean;
1384
1384
  //#endregion
1385
1385
  //#region src/extensions/math.d.ts
1386
1386
  /**
1387
1387
  * Inline math rendering: a KaTeX preview on the `mdMath` mark.
1388
1388
  */
1389
- declare function defineMath(): PlainExtension;
1389
+ export declare function defineMath(): PlainExtension;
1390
1390
  //#endregion
1391
1391
  //#region src/extensions/node-names.d.ts
1392
1392
  /**
@@ -1394,26 +1394,26 @@ declare function defineMath(): PlainExtension;
1394
1394
  */
1395
1395
  declare const NODE_NAMES: readonly ["doc", "text", "paragraph", "heading", "blockquote", "list", "codeBlock", "horizontalRule", "htmlComment", "table", "tableRow", "tableCell", "tableHeaderCell"];
1396
1396
  type NodeName = (typeof NODE_NAMES)[number];
1397
- declare function isNodeOfType(node: ProseMirrorNode, name: NodeName): boolean;
1397
+ export declare function isNodeOfType(node: ProseMirrorNode, name: NodeName): boolean;
1398
1398
  //#endregion
1399
1399
  //#region src/extensions/spell-check.d.ts
1400
1400
  /**
1401
1401
  * @deprecated This will be removed in future versions.
1402
1402
  */
1403
- declare function defineSpellCheckPlugin(spellCheck: boolean): PlainExtension;
1403
+ export declare function defineSpellCheckPlugin(spellCheck: boolean): PlainExtension;
1404
1404
  //#endregion
1405
1405
  //#region src/extensions/substitution.d.ts
1406
1406
  /**
1407
1407
  * Apply the editor's automatic plain-text substitutions.
1408
1408
  */
1409
- declare function defineSubstitution(): PlainExtension;
1409
+ export declare function defineSubstitution(): PlainExtension;
1410
1410
  //#endregion
1411
1411
  //#region src/extensions/table.d.ts
1412
1412
  /**
1413
1413
  * Whether the selection sits inside a table cell (data or header). Useful for
1414
1414
  * gating block-creating UI, since cells hold inline content only.
1415
1415
  */
1416
- declare function isSelectionInTableCell(state: EditorState): boolean;
1416
+ export declare function isSelectionInTableCell(state: EditorState): boolean;
1417
1417
  //#endregion
1418
1418
  //#region src/extensions/view-attributes.d.ts
1419
1419
  /**
@@ -1421,7 +1421,7 @@ declare function isSelectionInTableCell(state: EditorState): boolean;
1421
1421
  * every such extension are combined, so applying this more than once adds
1422
1422
  * classes instead of replacing them.
1423
1423
  */
1424
- declare function defineViewAttributes(attributes: {
1424
+ export declare function defineViewAttributes(attributes: {
1425
1425
  [name: string]: string;
1426
1426
  } | ((state: EditorState) => {
1427
1427
  [name: string]: string;
@@ -1444,7 +1444,7 @@ declare function defineViewAttributes(attributes: {
1444
1444
  * it must live outside the contenteditable and scroll together with the
1445
1445
  * content.
1446
1446
  */
1447
- declare function defineVirtualCaret(layer: HTMLElement): PlainExtension;
1447
+ export declare function defineVirtualCaret(layer: HTMLElement): PlainExtension;
1448
1448
  //#endregion
1449
1449
  //#region src/extensions/wikilink-hover.d.ts
1450
1450
  /**
@@ -1467,37 +1467,37 @@ type WikilinkHoverHandler = (hit: WikilinkHoverHit | undefined) => void;
1467
1467
  * when the hovered link is deleted, replaced, or changes target. Moving among
1468
1468
  * descendants of one label is de-duplicated.
1469
1469
  */
1470
- declare function defineWikilinkHoverHandler(onHoverChange: WikilinkHoverHandler): PlainExtension;
1470
+ export declare function defineWikilinkHoverHandler(onHoverChange: WikilinkHoverHandler): PlainExtension;
1471
1471
  //#endregion
1472
1472
  //#region src/extensions/wikilink-trigger.d.ts
1473
1473
  /**
1474
1474
  * Binds `Mod-Shift-k` to open the wikilink menu, and `[` to wrap a selected
1475
1475
  * phrase into an open wikilink (`[[phrase`) with the menu searching it.
1476
1476
  */
1477
- declare function defineWikilinkTrigger(): PlainExtension;
1477
+ export declare function defineWikilinkTrigger(): PlainExtension;
1478
1478
  //#endregion
1479
1479
  //#region src/utils/composition.d.ts
1480
- declare function getIsComposing(): boolean;
1480
+ export declare function getIsComposing(): boolean;
1481
1481
  //#endregion
1482
1482
  //#region src/utils/display-text.d.ts
1483
1483
  /**
1484
1484
  * The textblock as its live-preview marks display it: syntax runs are
1485
1485
  * omitted and each atom unit is replaced by its display text.
1486
1486
  */
1487
- declare function getTextblockDisplayText(textblock: ProseMirrorNode): string;
1487
+ export declare function getTextblockDisplayText(textblock: ProseMirrorNode): string;
1488
1488
  //#endregion
1489
1489
  //#region src/utils/format-file-size.d.ts
1490
1490
  /**
1491
1491
  * Format a byte count for display on a file pill: decimal units (1 KB =
1492
1492
  * 1000 B, matching macOS Finder), one decimal below 10, integers otherwise.
1493
1493
  */
1494
- declare function formatFileSize(bytes: number): string;
1494
+ export declare function formatFileSize(bytes: number): string;
1495
1495
  //#endregion
1496
1496
  //#region src/utils/is-mod-event.d.ts
1497
1497
  /**
1498
1498
  * Whether the platform's mod key is held on `event`: `Command` on Apple, `Ctrl` elsewhere.
1499
1499
  */
1500
- declare function isModEvent(event: MouseEvent | KeyboardEvent | TouchEvent | {
1500
+ export declare function isModEvent(event: MouseEvent | KeyboardEvent | TouchEvent | {
1501
1501
  metaKey: boolean;
1502
1502
  ctrlKey: boolean;
1503
1503
  }): boolean;
@@ -1510,14 +1510,14 @@ type KaTeXRender = typeof render;
1510
1510
  * Load KaTeX's render function on first use and cache it. Most documents
1511
1511
  * contain no math, so the library stays out of the initial bundle.
1512
1512
  */
1513
- declare function loadKaTeX(): Promise<KaTeXRender>;
1513
+ export declare function loadKaTeX(): Promise<KaTeXRender>;
1514
1514
  /**
1515
1515
  * Render TeX into `element` as native MathML (no KaTeX stylesheet or fonts
1516
1516
  * required). `throwOnError: false` renders parse errors as red text; the
1517
1517
  * catch covers the rare non-parse error so a bad formula can never crash a
1518
1518
  * render.
1519
1519
  */
1520
- declare function renderMathInto(katexRender: KaTeXRender, element: HTMLElement, formula: string, displayMode: boolean): void;
1520
+ export declare function renderMathInto(katexRender: KaTeXRender, element: HTMLElement, formula: string, displayMode: boolean): void;
1521
1521
  //#endregion
1522
1522
  //#region src/utils/selected-text.d.ts
1523
1523
  /**
@@ -1527,7 +1527,7 @@ declare function renderMathInto(katexRender: KaTeXRender, element: HTMLElement,
1527
1527
  * bare text; a multi-block selection keeps its block markers, so downstream
1528
1528
  * consumers (e.g. an AI prompt) see the same Markdown the user would.
1529
1529
  */
1530
- declare function getSelectedText(state: EditorState): string;
1530
+ export declare function getSelectedText(state: EditorState): string;
1531
1531
  //#endregion
1532
1532
  //#region src/utils/virtual-element.d.ts
1533
1533
  /**
@@ -1537,6 +1537,6 @@ declare function getSelectedText(state: EditorState): string;
1537
1537
  * frames), so a measurement can fire after the view is destroyed or the range
1538
1538
  * no longer resolves; those return the last known rect instead of throwing.
1539
1539
  */
1540
- declare function getVirtualElementFromRange(view: EditorView, range: PositionRange): VirtualElement;
1540
+ export declare function getVirtualElementFromRange(view: EditorView, range: PositionRange): VirtualElement;
1541
1541
  //#endregion
1542
- export { type AcceptPendingReplacementOptions, type CheckRoundTripOptions, type CodeBlockAttrs, type CodeBlockFenceStyle, type CodeToken, type DocToMarkdownOptions, EDITOR_KEY_BINDINGS, type EditorExtension, type EditorExtensionOptions, type EmbedDescriptor, type ExitBoundaryHandler, type ExitBoundaryOptions, type FileClickHandler, type FileClickPayload, type FileInfo, type FileInfoResolver, type FileLinkOptions, type FileLinkPayload, type FileLinkResolver, type FilePasteHandler, type FilePasteOptions, type FileSaveErrorHandler, type FileViewOptions, type FollowLinkHandlers, type ImageClickHandler, type ImageClickPayload, type ImageOptions, type InlineMarkContext, type InlineMarkOptions, type KaTeXRender, type LanguageItem, type LinkAttrs, type LinkClickHandler, type LinkClickPayload, type LinkCopyHandler, type LinkCopyPayload, type LinkEditHandler, type LinkEditOptions, type LinkHoverHandler, type LinkUnit, type ListMarker, type MarkChunk, type MarkMode, type MarkName, type MarkdownToDocOptions, type MdFileAttrs, type MdImageAttrs, type MdLinkTextAttrs, type MdMathAttrs, type MdWikilinkAttrs, type MeowdownCodeBlockAttrs, type MeowdownHTMLCommentAttrs, type MeowdownListAttrs, type MeowdownTableCellAttrs, type NodeName, type ParsedWikiEmbed, type PendingReplacement, type PendingReplacementEvent, type PendingReplacementHandler, type PendingReplacementMode, type PendingReplacementOutcome, type PlaceholderOptions, type PositionRange, Priority, type ReferenceDefinition, type ReferenceDefinitionIndex, type ReferenceDefinitions, type RoundTripFidelity, type SearchStatus, type SearchStatusHandler, type StartPendingReplacementOptions, type TableColumnAlign, type TagClickHandler, type TagClickPayload, type TypedEditor, type TypedMarkBuilders, type VirtualElement, type WikiEmbedOptions, type WikiEmbedResolution, type WikiEmbedResolver, type WikilinkClickHandler, type WikilinkClickPayload, type WikilinkHoverHandler, type WikilinkHoverHit, buildFileMarkdown, checkRoundTrip, codeBlockLanguages, collectReferenceDefinitions, defaultResolveImageUrl, defineBulletAfterHeading, defineCodeBlockPreviewPlugin, defineCodeBlockSyntaxHighlight, defineEditorExtension, defineEmbedPaste, defineExitBoundaryHandler, defineFileClickHandler, defineFilePaste, defineFileView, defineFollowLinkHandler, defineHTMLComment, defineImage, defineImageClickHandler, defineLinkClickHandler, defineLinkCommands, defineLinkEditKeymap, defineLinkHoverHandler, defineLinkPaste, defineMath, definePendingReplacementHandler, definePlaceholder, defineReadonly, defineSearchStatusHandler, defineSpellCheckPlugin, defineSubstitution, defineTagClickHandler, defineViewAttributes, defineVirtualCaret, defineWikilinkClickHandler, defineWikilinkHoverHandler, defineWikilinkTrigger, docToMarkdown, formatFileSize, formatSizedWikiEmbed, getCodeTokens, getFileKind, getIsComposing, getLinkUnitAt, getMarkBuilders, getPendingReplacement, getSearchStatus, getSelectedText, getTableColumnAlign, getTextblockDisplayText, getVirtualElementFromRange, inlineTextToMarkChunks, inlineTextToMarkChunksWithContext, insertLink, isCodeBlockPreviewHiddenDecoration, isMarkOfType, isModEvent, isNodeOfType, isSelectionInTableCell, listenForTweetHeight, loadKaTeX, markdownToDoc, matchEmbed, parseWikiEmbed, removeLink, renderMathInto, updateLink, wikiEmbedBasename, withPriority };
1542
+ export { type AcceptPendingReplacementOptions, type CheckRoundTripOptions, type CodeBlockAttrs, type CodeBlockFenceStyle, type CodeToken, type DocToMarkdownOptions, type EditorExtension, type EditorExtensionOptions, type EmbedDescriptor, type ExitBoundaryHandler, type ExitBoundaryOptions, type FileClickHandler, type FileClickPayload, type FileInfo, type FileInfoResolver, type FileLinkOptions, type FileLinkPayload, type FileLinkResolver, type FilePasteHandler, type FilePasteOptions, type FileSaveErrorHandler, type FileViewOptions, type FollowLinkHandlers, type ImageClickHandler, type ImageClickPayload, type ImageOptions, type InlineMarkContext, type InlineMarkOptions, type KaTeXRender, type LanguageItem, type LinkAttrs, type LinkClickHandler, type LinkClickPayload, type LinkCopyHandler, type LinkCopyPayload, type LinkEditHandler, type LinkEditOptions, type LinkHoverHandler, type LinkUnit, type ListMarker, type MarkChunk, type MarkMode, type MarkName, type MarkdownToDocOptions, type MdFileAttrs, type MdImageAttrs, type MdLinkTextAttrs, type MdMathAttrs, type MdWikilinkAttrs, type MeowdownCodeBlockAttrs, type MeowdownHTMLCommentAttrs, type MeowdownListAttrs, type MeowdownTableCellAttrs, type NodeName, type ParsedWikiEmbed, type PendingReplacement, type PendingReplacementEvent, type PendingReplacementHandler, type PendingReplacementMode, type PendingReplacementOutcome, type PlaceholderOptions, type PositionRange, Priority, type ReferenceDefinition, type ReferenceDefinitionIndex, type ReferenceDefinitions, type RoundTripFidelity, type SearchStatus, type SearchStatusHandler, type StartPendingReplacementOptions, type TableColumnAlign, type TagClickHandler, type TagClickPayload, type TypedEditor, type TypedMarkBuilders, type VirtualElement, type WikiEmbedOptions, type WikiEmbedResolution, type WikiEmbedResolver, type WikilinkClickHandler, type WikilinkClickPayload, type WikilinkHoverHandler, type WikilinkHoverHit, defineCodeBlockPreviewPlugin, definePlaceholder, defineReadonly, defineSearchStatusHandler, getSearchStatus, isCodeBlockPreviewHiddenDecoration, withPriority };
package/dist/index.js CHANGED
@@ -2749,8 +2749,10 @@ function applySequentialChunks(doc, chunks) {
2749
2749
  rebuilt = [];
2750
2750
  for (let seen = 0; seen < index; seen++) rebuilt.push(node.child(seen));
2751
2751
  }
2752
- if (rebuilt != null) if (Array.isArray(replacement)) rebuilt.push(...replacement);
2753
- else rebuilt.push(replacement);
2752
+ if (rebuilt != null) {
2753
+ if (Array.isArray(replacement)) rebuilt.push(...replacement);
2754
+ else rebuilt.push(replacement);
2755
+ }
2754
2756
  childFrom = childTo;
2755
2757
  }
2756
2758
  return rebuilt == null ? void 0 : Fragment.fromArray(rebuilt);
@@ -5805,20 +5807,22 @@ function scrollRectIntoView(view, rect, startDOM) {
5805
5807
  else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom")) moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
5806
5808
  if (rect.left < bounding.left + getSide(scrollThreshold, "left")) moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
5807
5809
  else if (rect.right > bounding.right - getSide(scrollThreshold, "right")) moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
5808
- if (moveX || moveY) if (atTop) doc.defaultView?.scrollBy(moveX, moveY);
5809
- else {
5810
- const startX = elt.scrollLeft;
5811
- const startY = elt.scrollTop;
5812
- if (moveY) elt.scrollTop += moveY;
5813
- if (moveX) elt.scrollLeft += moveX;
5814
- const dX = elt.scrollLeft - startX;
5815
- const dY = elt.scrollTop - startY;
5816
- rect = {
5817
- left: rect.left - dX,
5818
- top: rect.top - dY,
5819
- right: rect.right - dX,
5820
- bottom: rect.bottom - dY
5821
- };
5810
+ if (moveX || moveY) {
5811
+ if (atTop) doc.defaultView?.scrollBy(moveX, moveY);
5812
+ else {
5813
+ const startX = elt.scrollLeft;
5814
+ const startY = elt.scrollTop;
5815
+ if (moveY) elt.scrollTop += moveY;
5816
+ if (moveX) elt.scrollLeft += moveX;
5817
+ const dX = elt.scrollLeft - startX;
5818
+ const dY = elt.scrollTop - startY;
5819
+ rect = {
5820
+ left: rect.left - dX,
5821
+ top: rect.top - dY,
5822
+ right: rect.right - dX,
5823
+ bottom: rect.bottom - dY
5824
+ };
5825
+ }
5822
5826
  }
5823
5827
  const pos = atTop ? "fixed" : getComputedStyle(elt).position;
5824
5828
  if (/^(?:fixed|sticky)$/.test(pos)) break;
@@ -6567,23 +6571,35 @@ const CONTAINER_PREFIX_RE = /^(?:[\s>]|[-+*](?=\s|$)|\d{1,9}[.)](?=\s|$))+/u;
6567
6571
  function stripWhitespace(line) {
6568
6572
  return line.replaceAll(/\s/gu, "");
6569
6573
  }
6574
+ function shortenFenceRun(line) {
6575
+ const fence = line.charCodeAt(0);
6576
+ if (fence !== 96 && fence !== 126) return line;
6577
+ let width = 1;
6578
+ while (line.charCodeAt(width) === fence) width++;
6579
+ return width > 3 ? line.slice(0, 3) + line.slice(width) : line;
6580
+ }
6570
6581
  const DELIMITER_CELL_RE = /^:?-+:?$/u;
6582
+ function reduceCell(cell) {
6583
+ return stripWhitespace(shortenFenceRun(cell.replace(CONTAINER_PREFIX_RE, "")));
6584
+ }
6571
6585
  function canonicalizeTableRow(line) {
6572
6586
  if (!line.includes("|")) return void 0;
6573
- const cells = line.replace(/^\|/u, "").replace(/\|$/u, "").split("|");
6574
- if (cells.every((cell) => DELIMITER_CELL_RE.test(cell))) return "";
6587
+ const cells = line.replace(/^\s*\|/u, "").replace(/\|\s*$/u, "").split("|").map(reduceCell);
6588
+ if (cells.every((cell) => cell === "" || DELIMITER_CELL_RE.test(cell))) return "";
6575
6589
  return cells.filter((cell) => cell !== "").join("|");
6576
6590
  }
6577
6591
  /**
6578
6592
  * The lines of `text` that carry content, each reduced to that content. A line
6579
- * left empty by dropping its markers and whitespace (a blank line, a bare `>`,
6580
- * a list marker whose content is on the next line) carries none and is skipped.
6593
+ * left empty by dropping its markers, whitespace, and table structure (a blank
6594
+ * line, a bare `>`, a list marker whose content is on the next line, a
6595
+ * delimiter row or a lone delimiter cell) carries none and is skipped.
6581
6596
  */
6582
6597
  function contentLines(text) {
6583
6598
  const lines = [];
6584
6599
  for (const line of text.split("\n")) {
6585
- const content = stripWhitespace(line.replace(CONTAINER_PREFIX_RE, ""));
6586
- if (content !== "") lines.push(canonicalizeTableRow(content) ?? content);
6600
+ const bare = line.replace(CONTAINER_PREFIX_RE, "");
6601
+ const content = canonicalizeTableRow(bare) ?? stripWhitespace(shortenFenceRun(bare));
6602
+ if (content !== "" && !DELIMITER_CELL_RE.test(content)) lines.push(content);
6587
6603
  }
6588
6604
  return lines;
6589
6605
  }
@@ -7737,8 +7753,10 @@ var ImageMarkView = class {
7737
7753
  if (next.src !== previous.src) return false;
7738
7754
  this.#attrs = next;
7739
7755
  if (this.#image && next.alt !== previous.alt) this.#image.alt = next.alt;
7740
- if (this.#resizableRoot && (next.width !== previous.width || next.height !== previous.height)) if (this.#image) applyImageDisplaySize(this.#resizableRoot, this.#image, next.width, next.height);
7741
- else applySize(this.#resizableRoot, next.width, next.height);
7756
+ if (this.#resizableRoot && (next.width !== previous.width || next.height !== previous.height)) {
7757
+ if (this.#image) applyImageDisplaySize(this.#resizableRoot, this.#image, next.width, next.height);
7758
+ else applySize(this.#resizableRoot, next.width, next.height);
7759
+ }
7742
7760
  if (this.#tweetIframe && next.height !== previous.height) applyTweetHeight(this.#tweetIframe, next.height);
7743
7761
  return true;
7744
7762
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meowdown/core",
3
3
  "type": "module",
4
- "version": "0.65.3",
4
+ "version": "0.65.4",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -43,7 +43,7 @@
43
43
  "remark-stringify": "^11.0.0",
44
44
  "unicode-by-name": "^0.2.0",
45
45
  "unified": "^11.0.5",
46
- "@meowdown/markdown": "^0.65.3"
46
+ "@meowdown/markdown": "^0.65.4"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@ocavue/tsconfig": "^0.7.1",
@@ -51,6 +51,7 @@
51
51
  "@types/hast": "^3.0.5",
52
52
  "@types/mdast": "^4.0.4",
53
53
  "@vitest/browser-playwright": "^4.1.10",
54
+ "commonmark.json": "^0.31.0",
54
55
  "dedent": "^1.7.2",
55
56
  "diffable-html-snapshot": "^0.3.0",
56
57
  "fast-check": "^4.9.0",