Skip to content

Commit 7591d7f

Browse files
committed
Improve README
1 parent 080e8fb commit 7591d7f

1 file changed

Lines changed: 5 additions & 70 deletions

File tree

README.md

Lines changed: 5 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -30,68 +30,7 @@ Import type declarations with:
3030
import { MarkEdit } from 'markedit-api';
3131
```
3232

33-
The `MarkEdit` object provides these interfaces:
34-
35-
```ts
36-
interface MarkEdit {
37-
// Configuration of the current editor.
38-
editorConfig: Record<string, unknown>;
39-
// User-defined settings loaded from the settings.json file.
40-
userSettings: JSONObject;
41-
// CodeMirror EditorView instance of the current editor.
42-
editorView: EditorView;
43-
// Convenient text editing interfaces.
44-
editorAPI: TextEditable;
45-
// Retrieves a generative language model by name.
46-
languageModel(name: LanguageModelName): LanguageModel;
47-
// Retrieves the system translation service.
48-
translationService: TranslationService;
49-
// CodeMirror modules used by MarkEdit.
50-
codemirror: { view, state, language, langMarkdown, commands, search, autocomplete };
51-
// Lezer modules used by MarkEdit.
52-
lezer: { common, highlight, markdown, lr };
53-
// Get notified when the editor is initialized.
54-
onEditorReady(listener: (editorView: EditorView) => void): void;
55-
// Open a file in the file system.
56-
openFile(path: string): Promise<boolean>;
57-
// Create a file in the file system.
58-
createFile(options: CreateFileOptions): Promise<boolean>;
59-
// Delete a file from the file system.
60-
deleteFile(path: string): Promise<boolean>;
61-
// List all files under a directory.
62-
listFiles(path: string): Promise<string[] | undefined>;
63-
// Get the content of a file.
64-
getFileContent(path?: string): Promise<string | undefined>;
65-
// Get the binary data and type information of a file.
66-
getFileObject(path?: string): Promise<FileObject | undefined>;
67-
// Get the information of a file.
68-
getFileInfo(path?: string): Promise<FileInfo | undefined>;
69-
// Get the path of a standard directory.
70-
getDirectoryPath(type: DirectoryType): string;
71-
// Get all items from the native pasteboard.
72-
getPasteboardItems(): Promise<PasteboardItem[]>;
73-
// Get the string from the native pasteboard.
74-
getPasteboardString(): Promise<string | undefined>;
75-
// Add an extension to MarkEdit.
76-
addExtension(extension: Extension): void;
77-
// Add a Markdown config to MarkEdit.
78-
addMarkdownConfig(config: MarkdownConfig): void;
79-
// Add a language to be highlighted (in code blocks) to MarkEdit.
80-
addCodeLanguage(language: LanguageDescription): void;
81-
// Add a menu item to the status bar.
82-
addMainMenuItem(item: MenuItem | MenuItem[]): void;
83-
// Present a contextual menu to receive user input.
84-
showContextMenu(items: MenuItem[], location?: Point): void;
85-
// Present an alert to receive user input.
86-
showAlert(alert: Alert): Promise<number>;
87-
// Present a text box to receive user input.
88-
showTextBox(textBox?: TextBox): Promise<string | undefined>;
89-
// Present a save panel for saving the file.
90-
showSavePanel(options: SavePanelOptions): Promise<number>;
91-
// Run a system service with input.
92-
runService(name: string, input?: string): Promise<boolean>;
93-
}
94-
```
33+
Refer to the [index.d.ts](index.d.ts) file for all available interfaces and type definitions.
9534

9635
Also, you can import and use [CodeMirror](https://codemirror.net/) and [Lezer](https://lezer.codemirror.net/) dependencies like this:
9736

@@ -126,9 +65,9 @@ MarkEdit.addCodeLanguage(language);
12665

12766
While you can certainly build user interfaces with JavaScript and CSS, leveraging native UI components might be a better option.
12867

129-
To create UI entries for your features, you can use the [addMainMenuItem](https://github.com/search?q=repo%3AMarkEdit-app%2FMarkEdit-api+addMainMenuItem&type=code) function, which adds an item to the "Extensions" submenu of the main menu, with keyboard shortcuts support.
68+
To create UI entries for your features, use `addMainMenuItem`, which adds an item to the "Extensions" submenu of the main menu, with keyboard shortcuts support.
13069

131-
To request user input, try using [showContextMenu](https://github.com/search?q=repo%3AMarkEdit-app%2FMarkEdit-api+showContextMenu&type=code), [showAlert](https://github.com/search?q=repo%3AMarkEdit-app%2FMarkEdit-api+showAlert&type=code), and [showTextBox](https://github.com/search?q=repo%3AMarkEdit-app%2FMarkEdit-api+showTextBox&type=code).
70+
To request user input, try using `showContextMenu`, `showAlert`, and `showTextBox`.
13271

13372
## Building
13473

@@ -189,15 +128,11 @@ Ensure the build system produces a single JavaScript file. If the build generate
189128
190129
## Using JavaScript
191130

192-
If you just want to quickly prototype with JavaScript, you can directly access CodeMirror and MarkEdit interfaces through objects assigned to the `MarkEdit` object. For example:
131+
You can directly access CodeMirror and MarkEdit interfaces through objects assigned to the `MarkEdit` object. For example:
193132

194133
```js
195134
const keymap = MarkEdit.codemirror.view.keymap;
196135
const editorAPI = MarkEdit.editorAPI;
197136
```
198137

199-
----
200-
201-
For complete examples, refer to [Example: Markdown Table Editor](https://github.com/MarkEdit-app/MarkEdit-mte), [Example: Text Highlight](https://github.com/MarkEdit-app/MarkEdit-highlight) and [Example: Vue Language Package](https://github.com/MarkEdit-app/MarkEdit-lang-vue).
202-
203-
Also, [index.d.ts](./index.d.ts) is fully typed and documented, use it as the API reference.
138+
This is useful when you simply want to prototype something quickly.

0 commit comments

Comments
 (0)