You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> The general workflow for creating a MarkEdit script involves leveraging [CodeMirror extensions](https://codemirror.net/docs/extensions/) to modify the app's behavior.
13
+
> The general workflow for creating a MarkEdit script involves leveraging [CodeMirror extensions](https://codemirror.net/docs/extensions/)or [Lezer parsers](https://lezer.codemirror.net/)to modify the app's behavior.
13
14
14
15
Add `markedit-api` to your (TypeScript) project's devDependencies:
15
16
@@ -52,14 +53,23 @@ Also, you can import and use [CodeMirror](https://codemirror.net/) and [Lezer](h
52
53
import { keymap } from'@codemirror/view';
53
54
import { Prec } from'@codemirror/state';
54
55
import { Tag } from'@lezer/highlight';
56
+
import { MarkdownConfig } from'@lezer/markdown';
55
57
```
56
58
57
-
Build a [CodeMirror extension](https://codemirror.net/docs/extensions/) with these dependencies, and add it to MarkEdit with:
59
+
Build [CodeMirror extension](https://codemirror.net/docs/extensions/) with these dependencies, and add it to MarkEdit with:
58
60
59
61
```ts
60
62
MarkEdit.addExtension(extension); // Can also add an array of extensions
61
63
```
62
64
65
+
Build [MarkdownConfig](https://github.com/lezer-parser/markdown?tab=readme-ov-file#user-content-markdownconfig) with these dependencies, and add it to MarkEdit with:
66
+
67
+
```ts
68
+
MarkEdit.addMarkdownConfig(config);
69
+
```
70
+
71
+
> While extensions and configs can theoretically be added at any time, it is recommended that they be added immediately after loading the script.
72
+
63
73
## Building
64
74
65
75
In your build configuration, mark used MarkEdit and CodeMirror dependencies as `external`.
For a complete example, refer to [Example (Markdown Table Editor)](https://github.com/MarkEdit-app/MarkEdit-mte).
134
+
For complete examples, refer to [Example (Markdown Table Editor)](https://github.com/MarkEdit-app/MarkEdit-mte) and [Example (Text Highlight)](https://github.com/MarkEdit-app/MarkEdit-highlight).
0 commit comments