Skip to content

Commit b806c00

Browse files
committed
Improve README
1 parent 66f9931 commit b806c00

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ Type definitions for the latest [MarkEdit](https://markedit.app) API.
66

77
- [MarkEdit Customization Guide](https://github.com/MarkEdit-app/MarkEdit/wiki/Customization)
88
- [Example (Markdown Table Editor)](https://github.com/MarkEdit-app/MarkEdit-mte)
9+
- [Example (Text Highlight)](https://github.com/MarkEdit-app/MarkEdit-highlight)
910

1011
## Usage
1112

12-
> 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.
1314
1415
Add `markedit-api` to your (TypeScript) project's devDependencies:
1516

@@ -52,14 +53,23 @@ Also, you can import and use [CodeMirror](https://codemirror.net/) and [Lezer](h
5253
import { keymap } from '@codemirror/view';
5354
import { Prec } from '@codemirror/state';
5455
import { Tag } from '@lezer/highlight';
56+
import { MarkdownConfig } from '@lezer/markdown';
5557
```
5658

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:
5860

5961
```ts
6062
MarkEdit.addExtension(extension); // Can also add an array of extensions
6163
```
6264

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+
6373
## Building
6474

6575
In your build configuration, mark used MarkEdit and CodeMirror dependencies as `external`.
@@ -121,4 +131,4 @@ const editorAPI = MarkEdit.editorAPI;
121131

122132
----
123133

124-
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

Comments
 (0)