@meowdown/core 0.77.0 → 0.78.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.
- package/dist/index.d.ts +45 -19
- package/dist/index.js +271 -1333
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Editor, Extension, ExtractMarkBuilders, ExtractNodeBuilders, PlainExtension, Priority, Union, withPriority } from "@prosekit/core";
|
|
2
2
|
import { CodeBlockAttrs, CodeBlockAttrs as CodeBlockAttrs$1, defineCodeBlockPreviewPlugin, isCodeBlockPreviewHiddenDecoration } from "@prosekit/extensions/code-block";
|
|
3
3
|
import { PlaceholderOptions, PlaceholderOptions as PlaceholderOptions$1, definePlaceholder } from "@prosekit/extensions/placeholder";
|
|
4
|
-
import { Command, EditorState, PluginKey } from "@prosekit/pm/state";
|
|
5
4
|
import { SearchStatus, SearchStatusHandler, defineSearchStatusHandler, getSearchStatus } from "@prosekit/extensions/search";
|
|
5
|
+
import { Command, EditorState, PluginKey } from "@prosekit/pm/state";
|
|
6
6
|
import { EditorView } from "@prosekit/pm/view";
|
|
7
7
|
import { EditorNode, Mark, ProseMirrorNode } from "@prosekit/pm/model";
|
|
8
8
|
import { ListAttrs } from "@prosekit/extensions/list";
|
|
@@ -12,9 +12,6 @@ import { YouTubeVideoClickEvent } from "@meowdown/embed/youtube";
|
|
|
12
12
|
import { render } from "katex";
|
|
13
13
|
import { XPost, YouTubeVideo } from "@post-embed/types";
|
|
14
14
|
import { VirtualElement } from "@floating-ui/dom";
|
|
15
|
-
//#region src/extensions/readonly.d.ts
|
|
16
|
-
export declare function defineReadonly(getReadonly?: (state: EditorState) => boolean): PlainExtension;
|
|
17
|
-
//#endregion
|
|
18
15
|
//#region src/converters/check-roundtrip.d.ts
|
|
19
16
|
/**
|
|
20
17
|
* How faithfully markdown survives a parse-then-serialize round trip:
|
|
@@ -1039,7 +1036,12 @@ interface FileLinkOptions {
|
|
|
1039
1036
|
/**
|
|
1040
1037
|
* Host options that influence source-backed inline atom parsing.
|
|
1041
1038
|
*/
|
|
1042
|
-
type InlineMarkOptions = FileLinkOptions & WikiEmbedOptions & WikilinkOptions
|
|
1039
|
+
type InlineMarkOptions = FileLinkOptions & WikiEmbedOptions & WikilinkOptions & {
|
|
1040
|
+
/**
|
|
1041
|
+
* Definitions supplied by the containing document.
|
|
1042
|
+
*/
|
|
1043
|
+
referenceDefinitions?: ReferenceDefinitions;
|
|
1044
|
+
};
|
|
1043
1045
|
interface InlineMarkContext {
|
|
1044
1046
|
/**
|
|
1045
1047
|
* Effective document-wide definitions, keyed by normalized reference label.
|
|
@@ -1153,7 +1155,7 @@ declare function defineEditorExtensionImpl(options: EditorExtensionOptions): imp
|
|
|
1153
1155
|
}>, import("@prosekit/core").Extension<{
|
|
1154
1156
|
Nodes: {
|
|
1155
1157
|
list: {
|
|
1156
|
-
taskMarker?:
|
|
1158
|
+
taskMarker?: "x" | "X" | null;
|
|
1157
1159
|
};
|
|
1158
1160
|
};
|
|
1159
1161
|
}>, import("@prosekit/core").Extension<{
|
|
@@ -1362,19 +1364,7 @@ interface DocToMarkdownOptions {
|
|
|
1362
1364
|
frontmatter?: boolean;
|
|
1363
1365
|
}
|
|
1364
1366
|
/**
|
|
1365
|
-
* Convert
|
|
1366
|
-
*
|
|
1367
|
-
* Performance design:
|
|
1368
|
-
* - Output accumulates in a `string[]` buffer; joined once at the end.
|
|
1369
|
-
* Avoids per-block intermediate strings while keeping the
|
|
1370
|
-
* function-per-node-type readability of a switch dispatch.
|
|
1371
|
-
* - Indent stack lives as a mutable `linePrefix` on the buffer object,
|
|
1372
|
-
* restored via local variables across nested calls - no fresh
|
|
1373
|
-
* context objects per recursion.
|
|
1374
|
-
* - Inline content is walked directly (not via `node.textContent`) to
|
|
1375
|
-
* skip one intermediate string allocation per leaf block.
|
|
1376
|
-
* - Backtick fence width and cell escaping use single linear loops, no
|
|
1377
|
-
* regex on the hot path.
|
|
1367
|
+
* Convert persisted editor content to Markdown through the shared block serializer.
|
|
1378
1368
|
*/
|
|
1379
1369
|
export declare function docToMarkdown(node: ProseMirrorNode, options?: DocToMarkdownOptions): string;
|
|
1380
1370
|
//#endregion
|
|
@@ -1549,6 +1539,9 @@ declare const NODE_NAMES: readonly ["doc", "text", "paragraph", "heading", "bloc
|
|
|
1549
1539
|
type NodeName = (typeof NODE_NAMES)[number];
|
|
1550
1540
|
export declare function isNodeOfType(node: ProseMirrorNode, name: NodeName): boolean;
|
|
1551
1541
|
//#endregion
|
|
1542
|
+
//#region src/extensions/readonly.d.ts
|
|
1543
|
+
export declare function defineReadonly(getReadonly?: (state: EditorState) => boolean): PlainExtension;
|
|
1544
|
+
//#endregion
|
|
1552
1545
|
//#region src/extensions/substitution.d.ts
|
|
1553
1546
|
/**
|
|
1554
1547
|
* Apply the editor's automatic plain-text substitutions.
|
|
@@ -1689,4 +1682,37 @@ export declare function getSelectedText(state: EditorState): string;
|
|
|
1689
1682
|
*/
|
|
1690
1683
|
export declare function getVirtualElementFromRange(view: EditorView, range: PositionRange): VirtualElement;
|
|
1691
1684
|
//#endregion
|
|
1685
|
+
//#region src/converters/paragraph.d.ts
|
|
1686
|
+
/**
|
|
1687
|
+
* Build one paragraph without interpreting block-opening Markdown.
|
|
1688
|
+
*/
|
|
1689
|
+
export declare function paragraphMarkdownToDoc(markdown: string, nodes?: TypedNodeBuilders): ProseMirrorNode;
|
|
1690
|
+
/**
|
|
1691
|
+
* Flatten textblocks into one paragraph's source content.
|
|
1692
|
+
*/
|
|
1693
|
+
export declare function docToParagraphMarkdown(doc: ProseMirrorNode): string;
|
|
1694
|
+
//#endregion
|
|
1695
|
+
//#region src/extensions/single-paragraph.d.ts
|
|
1696
|
+
/**
|
|
1697
|
+
* Keep editing and pasted content within one paragraph.
|
|
1698
|
+
* Opt into this extension for inline Markdown fields such as task paragraphs.
|
|
1699
|
+
* Register it alongside `defineMeowdown`, seed content with
|
|
1700
|
+
* `paragraphMarkdownToDoc`, and read edits with `docToParagraphMarkdown`.
|
|
1701
|
+
* Ordinary note editors should keep their full document behavior.
|
|
1702
|
+
*
|
|
1703
|
+
* Text input stays literal, before block input rules can consume prefixes.
|
|
1704
|
+
* Transactions and pasted blocks flatten to paragraph text separated by soft
|
|
1705
|
+
* lines. Reference definitions come from `referenceDefinitions` in the editor
|
|
1706
|
+
* config; definition-looking content in the field remains visible literal text.
|
|
1707
|
+
* Enter/submit, focus, and persistence remain the caller's responsibility.
|
|
1708
|
+
*
|
|
1709
|
+
* @example
|
|
1710
|
+
* const editor = createEditor({
|
|
1711
|
+
* extension: union(defineMeowdown({ referenceDefinitions }), defineSingleParagraph()),
|
|
1712
|
+
* defaultContent: paragraphMarkdownToDoc('Buy **milk**'),
|
|
1713
|
+
* })
|
|
1714
|
+
* const markdown = docToParagraphMarkdown(editor.state.doc)
|
|
1715
|
+
*/
|
|
1716
|
+
export declare function defineSingleParagraph(): PlainExtension;
|
|
1717
|
+
//#endregion
|
|
1692
1718
|
export { type AcceptPendingReplacementOptions, type CheckRoundTripOptions, type CodeBlockAttrs, type CodeBlockFenceStyle, type CodeToken, type DocToMarkdownOptions, type EditorConfig, type EditorExtension, type EditorExtensionOptions, 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 ImageUrlResolver, 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 LinkHoverOptions, type LinkPreview, type LinkPreviewResolver, 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, type PostEmbedSnapshot, 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, type WikilinkOptions, type WikilinkPayload, type WikilinkResolution, type WikilinkResolver, type XPostMediaClickHandler, type XPostResolver, type YouTubeVideoClickHandler, type YouTubeVideoResolver, defineCodeBlockPreviewPlugin, definePlaceholder, defineSearchStatusHandler, getSearchStatus, isCodeBlockPreviewHiddenDecoration, withPriority };
|