@moraya/core 0.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.
- package/CHANGELOG.md +344 -0
- package/LICENSE +85 -0
- package/README.md +82 -0
- package/dist/adapters/browser-media-resolver.d.ts +21 -0
- package/dist/adapters/browser-media-resolver.js +24 -0
- package/dist/adapters/browser-media-resolver.js.map +1 -0
- package/dist/commands.d.ts +35 -0
- package/dist/commands.js +976 -0
- package/dist/commands.js.map +1 -0
- package/dist/doc-cache.d.ts +29 -0
- package/dist/doc-cache.js +50 -0
- package/dist/doc-cache.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +4534 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown.d.ts +46 -0
- package/dist/markdown.js +1553 -0
- package/dist/markdown.js.map +1 -0
- package/dist/plugins/code-block-view.d.ts +52 -0
- package/dist/plugins/code-block-view.js +686 -0
- package/dist/plugins/code-block-view.js.map +1 -0
- package/dist/plugins/cursor-syntax.d.ts +27 -0
- package/dist/plugins/cursor-syntax.js +122 -0
- package/dist/plugins/cursor-syntax.js.map +1 -0
- package/dist/plugins/definition-list.d.ts +23 -0
- package/dist/plugins/definition-list.js +12 -0
- package/dist/plugins/definition-list.js.map +1 -0
- package/dist/plugins/editor-props-plugin.d.ts +36 -0
- package/dist/plugins/editor-props-plugin.js +1963 -0
- package/dist/plugins/editor-props-plugin.js.map +1 -0
- package/dist/plugins/emoji.d.ts +21 -0
- package/dist/plugins/emoji.js +42 -0
- package/dist/plugins/emoji.js.map +1 -0
- package/dist/plugins/enter-handler.d.ts +26 -0
- package/dist/plugins/enter-handler.js +193 -0
- package/dist/plugins/enter-handler.js.map +1 -0
- package/dist/plugins/highlight.d.ts +39 -0
- package/dist/plugins/highlight.js +283 -0
- package/dist/plugins/highlight.js.map +1 -0
- package/dist/plugins/inline-code-convert.d.ts +32 -0
- package/dist/plugins/inline-code-convert.js +173 -0
- package/dist/plugins/inline-code-convert.js.map +1 -0
- package/dist/plugins/link-text-plugin.d.ts +22 -0
- package/dist/plugins/link-text-plugin.js +194 -0
- package/dist/plugins/link-text-plugin.js.map +1 -0
- package/dist/plugins/mermaid-renderer.d.ts +24 -0
- package/dist/plugins/mermaid-renderer.js +80 -0
- package/dist/plugins/mermaid-renderer.js.map +1 -0
- package/dist/schema.d.ts +48 -0
- package/dist/schema.js +847 -0
- package/dist/schema.js.map +1 -0
- package/dist/setup.d.ts +104 -0
- package/dist/setup.js +4393 -0
- package/dist/setup.js.map +1 -0
- package/dist/types.d.ts +107 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +121 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Schema, Node } from 'prosemirror-model';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Markdown ↔ ProseMirror Doc roundtrip for `@moraya/core`.
|
|
5
|
+
*
|
|
6
|
+
* Faithful 1:1 migration from Moraya desktop `src/lib/editor/markdown.ts`.
|
|
7
|
+
* Uses `prosemirror-markdown` with `markdown-it` as the tokenizer.
|
|
8
|
+
*
|
|
9
|
+
* Supports: CommonMark + GFM (tables, strikethrough, task lists) +
|
|
10
|
+
* math (via markdown-it-texmath) + definition lists +
|
|
11
|
+
* paired raw-HTML marks + frontmatter / footnote pass-through.
|
|
12
|
+
*
|
|
13
|
+
* Configuration matches Milkdown output conventions:
|
|
14
|
+
* - bullet: '-'
|
|
15
|
+
* - horizontal rule: '---'
|
|
16
|
+
* - strong: '**'
|
|
17
|
+
* - emphasis: '*'
|
|
18
|
+
*
|
|
19
|
+
* Serializer wraps `defaultSchema` (host-agnostic NullMediaResolver). The
|
|
20
|
+
* schema's structural shape is identical to consumer-injected schemas
|
|
21
|
+
* (same NodeSpec/MarkSpec ids), so a doc parsed against `defaultSchema`
|
|
22
|
+
* round-trips through any consumer schema without rebuilding.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Parse a markdown string into a ProseMirror document node. Never throws (§4.5).
|
|
27
|
+
*
|
|
28
|
+
* @param markdown Source markdown string (may contain frontmatter, math, html, etc.).
|
|
29
|
+
* @param schemaArg Optional consumer schema. When provided, the returned doc's
|
|
30
|
+
* `node.type` references the consumer's NodeType identities,
|
|
31
|
+
* allowing it to be loaded directly into an `EditorState.create`
|
|
32
|
+
* built with that same schema. Defaults to {@link defaultSchema}.
|
|
33
|
+
*/
|
|
34
|
+
declare function parseMarkdown(markdown: string, schemaArg?: Schema): Node;
|
|
35
|
+
/**
|
|
36
|
+
* Async version of parseMarkdown. For large files (≥50KB), yields to the
|
|
37
|
+
* event loop via setTimeout(0) so the main thread stays responsive.
|
|
38
|
+
* §4.5: never rejects.
|
|
39
|
+
*/
|
|
40
|
+
declare function parseMarkdownAsync(markdown: string, schemaArg?: Schema): Promise<Node>;
|
|
41
|
+
/**
|
|
42
|
+
* Serialize a ProseMirror document node to a markdown string. Never throws (§4.5).
|
|
43
|
+
*/
|
|
44
|
+
declare function serializeMarkdown(doc: Node): string;
|
|
45
|
+
|
|
46
|
+
export { parseMarkdown, parseMarkdownAsync, serializeMarkdown };
|