@openmarkdown-dev/editor 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +390 -2
- package/dist/editor.js +7539 -0
- package/dist/index.d.ts +363 -0
- package/dist/index.js +14 -0
- package/dist/no-diagrams.d.ts +365 -0
- package/dist/no-diagrams.js +9 -0
- package/package.json +85 -4
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { EditorView } from '@codemirror/view';
|
|
2
|
+
import { Extension, EditorState } from '@codemirror/state';
|
|
3
|
+
|
|
4
|
+
interface Heading {
|
|
5
|
+
/** Heading text without the `#` markers or a closing sequence. */
|
|
6
|
+
text: string;
|
|
7
|
+
/** 1–6. */
|
|
8
|
+
level: number;
|
|
9
|
+
/** The `::` join of the ancestor texts and this one, unescaped (for display; query with `anchor`). */
|
|
10
|
+
path: string;
|
|
11
|
+
/** `path`'s segments. */
|
|
12
|
+
segments: string[];
|
|
13
|
+
/**
|
|
14
|
+
* The plainest query that resolves to exactly this heading (see `anchorOf`),
|
|
15
|
+
* or null for a heading with no text (`#` alone): it names nothing.
|
|
16
|
+
*/
|
|
17
|
+
anchor: string | null;
|
|
18
|
+
/** 1-based line of the heading, and of the section's last line (inclusive). */
|
|
19
|
+
fromLine: number;
|
|
20
|
+
toLine: number;
|
|
21
|
+
/** Offset of the heading line start. */
|
|
22
|
+
from: number;
|
|
23
|
+
/** Offset right after the heading line's newline (the body start). */
|
|
24
|
+
bodyFrom: number;
|
|
25
|
+
/** Offset of the section end: the next heading of level ≤ own, or the end. */
|
|
26
|
+
to: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* One heading of the document, as `EditorHost.onOutline` reports it: its text,
|
|
31
|
+
* level, line range and offsets.
|
|
32
|
+
*/
|
|
33
|
+
type OutlineItem = Heading;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* How the editor shows the document: `live` renders Markdown in place and
|
|
37
|
+
* reveals the source under the caret; `source` is the plain text, colored;
|
|
38
|
+
* `reading` is rendered and read-only.
|
|
39
|
+
*/
|
|
40
|
+
type EditorMode = "live" | "source" | "reading";
|
|
41
|
+
/**
|
|
42
|
+
* What the editor calls back into, per document: pass it as `host` to
|
|
43
|
+
* `createEditorState`. The editor reads each member through the object when it
|
|
44
|
+
* needs it, so you can change the object later without rebuilding the state.
|
|
45
|
+
*
|
|
46
|
+
* Every member is optional: a capability the host does not provide is switched
|
|
47
|
+
* off quietly (no error, no notice) and the rest of the editor carries on.
|
|
48
|
+
* Window-wide capabilities live in the editor environment
|
|
49
|
+
* (`configureEditorEnvironment`).
|
|
50
|
+
*/
|
|
51
|
+
interface EditorHost {
|
|
52
|
+
/**
|
|
53
|
+
* The document changed; `doc` is the whole new source. `isUserEdit` is true for
|
|
54
|
+
* typing, pasting and other user actions, false for programmatic changes
|
|
55
|
+
* (`setDoc`). `docPath` is the document the change happened in, so a host that
|
|
56
|
+
* swaps documents can drop a change for one that is no longer shown.
|
|
57
|
+
*/
|
|
58
|
+
onChange?: (doc: string, isUserEdit: boolean, docPath: string | null) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Map an image target as written (``) to a URL the page may load, or
|
|
61
|
+
* null to show the source instead. Script-capable URLs are dropped whatever
|
|
62
|
+
* this returns. Absent: only absolute `https:` images load. It may be called
|
|
63
|
+
* more than once for the same image, so keep it free of side effects; when its
|
|
64
|
+
* answer changes, call `editor.refreshImages()`.
|
|
65
|
+
*/
|
|
66
|
+
resolveImage?: (src: string) => string | null;
|
|
67
|
+
/**
|
|
68
|
+
* A link to a local file was followed (Cmd/Ctrl+click; a plain click in reading
|
|
69
|
+
* mode): `absPath` is the target resolved against the document's directory, and
|
|
70
|
+
* `fragment` its decoded `#fragment` without the `#` (`other.md#setup` →
|
|
71
|
+
* `"setup"`), or null. The host decides whether the file exists, how to open it
|
|
72
|
+
* and whether to go to the fragment. Absent: local links do nothing.
|
|
73
|
+
*/
|
|
74
|
+
openLink?: (absPath: string, fragment: string | null) => void;
|
|
75
|
+
/**
|
|
76
|
+
* The root folder of the user's files, for link-target completion. A getter,
|
|
77
|
+
* read each time completion opens. Null, or absent: completion uses the
|
|
78
|
+
* document's own directory.
|
|
79
|
+
*/
|
|
80
|
+
getFolder?: () => string | null;
|
|
81
|
+
/** The selection, scroll position or document moved (debounced); use it to remember the position. */
|
|
82
|
+
onMoved?: () => void;
|
|
83
|
+
/**
|
|
84
|
+
* Store pasted / dropped image bytes beside `docPath`. `hint` is the file's
|
|
85
|
+
* name, or its MIME type. Resolves the document-relative path to link, or null
|
|
86
|
+
* when the save failed (report it yourself); then the editor inserts nothing.
|
|
87
|
+
* Only called when the document has a path.
|
|
88
|
+
* Absent: image paste / drop stores nothing and inserts nothing.
|
|
89
|
+
*/
|
|
90
|
+
saveAttachment?: (docPath: string, bytes: Uint8Array, hint: string | null) => Promise<string | null>;
|
|
91
|
+
/**
|
|
92
|
+
* Images were pasted or dropped but could not be stored, so nothing was
|
|
93
|
+
* inserted: `reason` is `"no-save-attachment"` (no `saveAttachment`) or
|
|
94
|
+
* `"no-doc-path"` (the document has no path to store them beside); `count` is
|
|
95
|
+
* how many images. Only a notice — the editor itself stays silent and the
|
|
96
|
+
* document is unchanged. Use it to tell the user. Absent: nothing happens.
|
|
97
|
+
*/
|
|
98
|
+
onUnsupportedPaste?: (reason: "no-save-attachment" | "no-doc-path", count: number) => void;
|
|
99
|
+
/**
|
|
100
|
+
* The linkable files under `root`, as root-relative paths (link-target
|
|
101
|
+
* completion). Absent: file completion offers nothing; heading completion is
|
|
102
|
+
* unaffected.
|
|
103
|
+
*/
|
|
104
|
+
listFiles?: (root: string) => Promise<string[]>;
|
|
105
|
+
/** The heading outline changed; null when the view is going away (clear yours). */
|
|
106
|
+
onOutline?: (outline: OutlineItem[] | null) => void;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The editor's own UI strings: exactly the words the editor draws — the find
|
|
111
|
+
* panel, the code-copy button, fold handles, the properties block, image and
|
|
112
|
+
* link chips, render failures — in every language it ships.
|
|
113
|
+
*
|
|
114
|
+
* The language is the host's to pick, through the editor environment's
|
|
115
|
+
* `language`; it is read when a string is drawn, never at module evaluation.
|
|
116
|
+
* Without a host language, or with one the editor does not ship, the editor
|
|
117
|
+
* speaks English: a fixed default, not a guess from the browser, so the editor
|
|
118
|
+
* behaves the same in every host and the host stays the only owner of
|
|
119
|
+
* language policy.
|
|
120
|
+
*/
|
|
121
|
+
/** The languages the editor ships (`zh` is Simplified Chinese). */
|
|
122
|
+
declare const EDITOR_LANGS: readonly ["zh", "ja", "ko", "en"];
|
|
123
|
+
/** A language the editor's own UI words ship in (`EditorEnvironment.language`). */
|
|
124
|
+
type EditorLang = (typeof EDITOR_LANGS)[number];
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The editor environment: window-wide capabilities the host provides once per
|
|
128
|
+
* page with `configureEditorEnvironment`. Per-document needs go through
|
|
129
|
+
* `EditorHost` instead.
|
|
130
|
+
*
|
|
131
|
+
* Every member is optional: what the host leaves out is switched off quietly —
|
|
132
|
+
* no error, no notice, no fallback of the editor's own. An editor mounted with
|
|
133
|
+
* no environment configured at all is light, English, editable, and has no
|
|
134
|
+
* copy, external-link, spelling or host-key behaviour.
|
|
135
|
+
*/
|
|
136
|
+
interface EditorEnvironment {
|
|
137
|
+
/**
|
|
138
|
+
* The language of the editor's own UI words. Read whenever a word is drawn,
|
|
139
|
+
* so set it before the first editor mounts; already-drawn words do not redraw
|
|
140
|
+
* on a change. Left out, or not one the editor ships: English.
|
|
141
|
+
*/
|
|
142
|
+
language?: EditorLang;
|
|
143
|
+
/** The window's light / dark scheme: its value now, and a subscription to changes (returns the unsubscribe). */
|
|
144
|
+
colorScheme?: {
|
|
145
|
+
current(): ColorScheme;
|
|
146
|
+
subscribe(cb: (scheme: ColorScheme) => void): () => void;
|
|
147
|
+
};
|
|
148
|
+
/** Put `text` on the clipboard (code-block copy button). The host reports success / failure itself. */
|
|
149
|
+
copyText?: (text: string) => unknown;
|
|
150
|
+
/** Open an external (non-file) link target, e.g. Cmd/Ctrl+click on `https://…`. The host owns the policy. */
|
|
151
|
+
openExternal?: (url: string) => unknown;
|
|
152
|
+
/**
|
|
153
|
+
* The editor refused to follow a script-capable link (`javascript:` /
|
|
154
|
+
* `vbscript:` / `data:` …, however obfuscated); `scheme` is the
|
|
155
|
+
* scheme as a browser reads it. For telling the user only: the URL MUST NOT
|
|
156
|
+
* be opened. Absent: the refusal is silent.
|
|
157
|
+
*/
|
|
158
|
+
refusedLink?: (url: string, scheme: string) => unknown;
|
|
159
|
+
/** The spell-checking service behind the editor's own squiggles and suggestions. Absent: no spell checking. */
|
|
160
|
+
spell?: SpellService;
|
|
161
|
+
/**
|
|
162
|
+
* Offered every key the editor's keymap sees, before CodeMirror's defaults:
|
|
163
|
+
* return true when the host ran a binding for it (the key is consumed).
|
|
164
|
+
*/
|
|
165
|
+
handleKey?: (view: EditorView, event: KeyboardEvent) => boolean;
|
|
166
|
+
}
|
|
167
|
+
/** The editor's light or dark look; it follows `EditorEnvironment.colorScheme`. */
|
|
168
|
+
type ColorScheme = "light" | "dark";
|
|
169
|
+
/** One misspelling, UTF-16 offsets into the paragraph that was sent. */
|
|
170
|
+
interface SpellMiss {
|
|
171
|
+
from: number;
|
|
172
|
+
to: number;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* A spell checker keyed by "spell document" numbers (one per top-level editor,
|
|
176
|
+
* so the checker can keep per-editor ignore lists).
|
|
177
|
+
*/
|
|
178
|
+
interface SpellService {
|
|
179
|
+
/** Is spell checking on right now? */
|
|
180
|
+
isOn(): boolean;
|
|
181
|
+
/** Follow the on / off state; returns the unsubscribe. */
|
|
182
|
+
onChange(cb: (on: boolean) => void): () => void;
|
|
183
|
+
/** A fresh spell-document number for a top-level editor. */
|
|
184
|
+
newDocument(): number;
|
|
185
|
+
/** Misspellings for each paragraph, in order; null when the check could not run. */
|
|
186
|
+
check(doc: number, paragraphs: string[]): Promise<SpellMiss[][] | null>;
|
|
187
|
+
/** Up to five suggestions for `paragraph.slice(from, to)`, in the checker's order. */
|
|
188
|
+
suggestions(doc: number, paragraph: string, from: number, to: number): Promise<string[]>;
|
|
189
|
+
/** The editor of `doc` is gone. */
|
|
190
|
+
closeDocument(doc: number): void;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Provide the window-wide capabilities (`EditorEnvironment`). Call once at
|
|
194
|
+
* startup, before the first editor mounts; a later call replaces the whole
|
|
195
|
+
* environment. Optional: without it the editor is light, English, and has no
|
|
196
|
+
* clipboard, external-link, spelling or host-key behaviour.
|
|
197
|
+
*/
|
|
198
|
+
declare function configureEditorEnvironment(env: EditorEnvironment): void;
|
|
199
|
+
|
|
200
|
+
/** A line ending as it appears in the file: LF, CRLF, or a lone CR. */
|
|
201
|
+
type LineEnding = "\n" | "\r\n" | "\r";
|
|
202
|
+
/**
|
|
203
|
+
* A Markdown file opened with `openMarkdownFile`: the text to give the editor,
|
|
204
|
+
* plus what `saveMarkdownFile` needs to write it back.
|
|
205
|
+
*/
|
|
206
|
+
interface MarkdownFile {
|
|
207
|
+
/**
|
|
208
|
+
* The text to edit: the file decoded as UTF-8, without a leading BOM, with
|
|
209
|
+
* every line ending turned into `\n`. Pass it as `doc` to `createEditorState`
|
|
210
|
+
* (or to `editor.setDoc`). Unicode is kept as written: nothing is normalized.
|
|
211
|
+
*/
|
|
212
|
+
text: string;
|
|
213
|
+
/**
|
|
214
|
+
* The file's original bytes (a copy of what was passed in).
|
|
215
|
+
* `saveMarkdownFile` returns them as they are while the text is unedited.
|
|
216
|
+
*/
|
|
217
|
+
bytes: Uint8Array;
|
|
218
|
+
/** Whether the file started with a UTF-8 BOM (`EF BB BF`). An edited save writes it back. */
|
|
219
|
+
bom: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* The line ending an edited save writes: the file's most frequent one; on a
|
|
222
|
+
* tie, the one that comes first in the file. `"\n"` for a file with no line
|
|
223
|
+
* break.
|
|
224
|
+
*/
|
|
225
|
+
ending: LineEnding;
|
|
226
|
+
/**
|
|
227
|
+
* Whether the file mixes line endings (two or more of LF, CRLF and lone CR).
|
|
228
|
+
* Unedited, it is saved as its original bytes, mix included; once edited,
|
|
229
|
+
* every line break is written as `ending`.
|
|
230
|
+
*/
|
|
231
|
+
mixed: boolean;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Thrown by `openMarkdownFile` when the bytes are not valid UTF-8. Refuse to
|
|
235
|
+
* open the file in the editor: decoding it anyway would replace the bad bytes
|
|
236
|
+
* with U+FFFD, and the next save would write that damage to disk. Recognise it
|
|
237
|
+
* with `instanceof`, or by `code` (`"INVALID_UTF8"`) across bundles.
|
|
238
|
+
*/
|
|
239
|
+
declare class InvalidUtf8Error extends Error {
|
|
240
|
+
/** Always `"INVALID_UTF8"`. */
|
|
241
|
+
readonly code = "INVALID_UTF8";
|
|
242
|
+
/** @param options.cause The decoder's own error. */
|
|
243
|
+
constructor(options?: {
|
|
244
|
+
cause?: unknown;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Open a Markdown file's bytes for the editor. Decodes strict UTF-8 (invalid
|
|
249
|
+
* bytes throw `InvalidUtf8Error`; nothing is replaced), notes and strips a
|
|
250
|
+
* leading BOM, detects the line endings (LF, CRLF, lone CR, or a mix) and turns
|
|
251
|
+
* them into `\n`, and keeps a copy of the original bytes. Save with
|
|
252
|
+
* `saveMarkdownFile`.
|
|
253
|
+
*
|
|
254
|
+
* @param bytes The file as read from disk, a network response or a file input.
|
|
255
|
+
* @returns The text to edit, and what saving needs to write the file back.
|
|
256
|
+
* @throws InvalidUtf8Error when `bytes` is not valid UTF-8.
|
|
257
|
+
*/
|
|
258
|
+
declare function openMarkdownFile(bytes: Uint8Array): MarkdownFile;
|
|
259
|
+
/**
|
|
260
|
+
* The bytes to write for the editor's document. Unedited (`doc` equals
|
|
261
|
+
* `file.text`), they are the original bytes, exactly. Edited, they are `doc`
|
|
262
|
+
* encoded as UTF-8 with the file's BOM put back and every line break written
|
|
263
|
+
* as `file.ending`; a file with mixed line endings gets uniform ones.
|
|
264
|
+
*
|
|
265
|
+
* @param doc The document to save, usually `editor.getDoc()`.
|
|
266
|
+
* @param file What `openMarkdownFile` returned for this file.
|
|
267
|
+
* @returns The file's bytes.
|
|
268
|
+
*/
|
|
269
|
+
declare function saveMarkdownFile(doc: string, file: MarkdownFile): Uint8Array;
|
|
270
|
+
|
|
271
|
+
/** What a new editor state starts with (`createEditorState`). Every field is optional. */
|
|
272
|
+
interface EditorStateOptions {
|
|
273
|
+
/** The Markdown source to edit. Default: the empty document. */
|
|
274
|
+
doc?: string;
|
|
275
|
+
/** Live preview (default), plain source, or read-only reading mode. */
|
|
276
|
+
mode?: EditorMode;
|
|
277
|
+
/** The document's absolute path, or null for an unsaved one. Relative links and images resolve against it, and pasted images are stored beside it. Default: null. */
|
|
278
|
+
docPath?: string | null;
|
|
279
|
+
/** Where the caret starts (UTF-16 offsets into `doc`). Default: the start of the document. */
|
|
280
|
+
selection?: {
|
|
281
|
+
anchor: number;
|
|
282
|
+
head?: number;
|
|
283
|
+
};
|
|
284
|
+
/** The per-document callbacks (change, links, images, attachments, completion, outline). Default: none. */
|
|
285
|
+
host?: EditorHost;
|
|
286
|
+
/**
|
|
287
|
+
* Draw spelling squiggles when the environment's spell service is on. Turn it
|
|
288
|
+
* off for an editor where a squiggle could not be fixed. Default true.
|
|
289
|
+
*/
|
|
290
|
+
checkSpelling?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Render ```` ```mermaid ```` fences as diagrams. With `false`, they show as
|
|
293
|
+
* ordinary code blocks and Mermaid is never loaded — for a page that must not
|
|
294
|
+
* download it, or whose Content Security Policy cannot allow Mermaid's inline
|
|
295
|
+
* styles (see the self-hosting guide). Default true. Ignored by the
|
|
296
|
+
* `@openmarkdown-dev/editor/no-diagrams` entry, which never renders diagrams
|
|
297
|
+
* and does not contain Mermaid at all.
|
|
298
|
+
*/
|
|
299
|
+
diagrams?: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Your own CodeMirror extensions, installed in this state beside the editor's.
|
|
302
|
+
* They stay installed in every mode and travel with the state.
|
|
303
|
+
*/
|
|
304
|
+
extensions?: Extension;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* A mounted editor (`mountEditor`): the CodeMirror view plus the operations a
|
|
308
|
+
* host needs. Call `destroy` when the editor leaves the page.
|
|
309
|
+
*/
|
|
310
|
+
interface MarkdownEditor {
|
|
311
|
+
/** The underlying CodeMirror view — the escape hatch for anything not covered here. */
|
|
312
|
+
view: EditorView;
|
|
313
|
+
/** The current Markdown source, byte for byte what is being edited. */
|
|
314
|
+
getDoc(): string;
|
|
315
|
+
/**
|
|
316
|
+
* Make `doc` the document, for example after the file changed on disk. Only
|
|
317
|
+
* the range that differs is replaced, so the scroll position, selection and
|
|
318
|
+
* folds outside it stay where they were (an agent appending a line does not
|
|
319
|
+
* move the reader). The same text does nothing. Not an undo step, and not a
|
|
320
|
+
* user edit: `onChange` reports it with `isUserEdit` false.
|
|
321
|
+
*/
|
|
322
|
+
setDoc(doc: string): void;
|
|
323
|
+
/**
|
|
324
|
+
* Ask the host's `resolveImage` again for every image, after its answer
|
|
325
|
+
* changed (the reader allowed remote images, say). An image that resolved to
|
|
326
|
+
* null showed its source; it now shows the picture if the new answer is a URL.
|
|
327
|
+
*/
|
|
328
|
+
refreshImages(): void;
|
|
329
|
+
/** The shown state's mode (it travels with the state). */
|
|
330
|
+
mode(): EditorMode;
|
|
331
|
+
/** The shown state's document path, or null for an unsaved document (it travels with the state). */
|
|
332
|
+
docPath(): string | null;
|
|
333
|
+
/** Switch between live preview, source and reading mode; document, selection and history are kept. */
|
|
334
|
+
setMode(mode: EditorMode): void;
|
|
335
|
+
/** The shown state's document moved (rename) or was given a path (empty state → note). */
|
|
336
|
+
setDocPath(path: string | null): void;
|
|
337
|
+
/**
|
|
338
|
+
* After swapping a state in (`editor.view.setState(state)`): bring what is the
|
|
339
|
+
* window's, not the document's — the light / dark half of CodeMirror's base
|
|
340
|
+
* theme — in line with now. A parked state kept the value it had when it left.
|
|
341
|
+
*/
|
|
342
|
+
syncAmbient(): void;
|
|
343
|
+
/** Tear the view down and drop the color-scheme subscription. */
|
|
344
|
+
destroy(): void;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Build an editor state: the document, caret, undo history, folds and mode,
|
|
348
|
+
* with the whole editor (live preview, structure keys, find, folding, tables,
|
|
349
|
+
* math) installed, but no diagrams: this is the
|
|
350
|
+
* `@openmarkdown-dev/editor/no-diagrams` entry, which does not contain Mermaid.
|
|
351
|
+
* A ```` ```mermaid ```` fence stays a code block and `options.diagrams` is
|
|
352
|
+
* ignored. Show the state with `mountEditor`; a host with several documents keeps
|
|
353
|
+
* one state per document and swaps them into one view
|
|
354
|
+
* (`editor.view.setState(state)`, then `editor.syncAmbient()`).
|
|
355
|
+
*/
|
|
356
|
+
declare function createEditorState(options: EditorStateOptions): EditorState;
|
|
357
|
+
/**
|
|
358
|
+
* Mount `state` (from `createEditorState`) in a new editor view appended to
|
|
359
|
+
* `parent`, following the environment's color scheme while it lives. Returns
|
|
360
|
+
* the editor handle; call its `destroy` when done.
|
|
361
|
+
*/
|
|
362
|
+
declare function mountEditor(parent: HTMLElement, state: EditorState): MarkdownEditor;
|
|
363
|
+
|
|
364
|
+
export { InvalidUtf8Error, configureEditorEnvironment, createEditorState, mountEditor, openMarkdownFile, saveMarkdownFile };
|
|
365
|
+
export type { ColorScheme, EditorEnvironment, EditorHost, EditorLang, EditorMode, EditorStateOptions, LineEnding, MarkdownEditor, MarkdownFile, OutlineItem, SpellMiss, SpellService };
|
package/package.json
CHANGED
|
@@ -1,6 +1,87 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmarkdown-dev/editor",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A live-preview Markdown editor on CodeMirror 6 that edits the Markdown source itself, for a lossless round-trip: open and save without editing, and the file is byte-for-byte what it was.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./no-diagrams": {
|
|
14
|
+
"types": "./dist/no-diagrams.d.ts",
|
|
15
|
+
"import": "./dist/no-diagrams.js",
|
|
16
|
+
"default": "./dist/no-diagrams.js"
|
|
17
|
+
},
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"module": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/index.js",
|
|
26
|
+
"dist/index.d.ts",
|
|
27
|
+
"dist/no-diagrams.js",
|
|
28
|
+
"dist/no-diagrams.d.ts",
|
|
29
|
+
"dist/editor.js"
|
|
30
|
+
],
|
|
31
|
+
"keywords": [
|
|
32
|
+
"markdown",
|
|
33
|
+
"markdown-editor",
|
|
34
|
+
"editor",
|
|
35
|
+
"codemirror",
|
|
36
|
+
"codemirror-6",
|
|
37
|
+
"live-preview",
|
|
38
|
+
"wysiwyg",
|
|
39
|
+
"embeddable",
|
|
40
|
+
"lossless",
|
|
41
|
+
"round-trip",
|
|
42
|
+
"gfm",
|
|
43
|
+
"mermaid",
|
|
44
|
+
"katex",
|
|
45
|
+
"typescript",
|
|
46
|
+
"react"
|
|
47
|
+
],
|
|
48
|
+
"homepage": "https://openmarkdown.dev/editor/",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/OpenMarkdown-dev/OpenMarkdown-editor.git"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/OpenMarkdown-dev/OpenMarkdown-editor/issues"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@codemirror/autocomplete": "^6.20.3",
|
|
58
|
+
"@codemirror/commands": "^6.10.4",
|
|
59
|
+
"@codemirror/lang-markdown": "^6.5.0",
|
|
60
|
+
"@codemirror/language": "^6.12.4",
|
|
61
|
+
"@codemirror/language-data": "^6.5.2",
|
|
62
|
+
"@codemirror/search": "^6.7.1",
|
|
63
|
+
"@codemirror/state": "^6.7.0",
|
|
64
|
+
"@codemirror/view": "^6.43.4",
|
|
65
|
+
"@lezer/highlight": "^1.2.3",
|
|
66
|
+
"@lezer/markdown": "^1.6.4"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"mermaid": "11.17.2",
|
|
70
|
+
"temml": "^0.11.11"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "node build.mjs",
|
|
74
|
+
"test": "vitest run",
|
|
75
|
+
"typecheck": "tsc --noEmit",
|
|
76
|
+
"update-api": "node build.mjs --update-api"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@lezer/common": "^1.5.2",
|
|
80
|
+
"@types/node": "^26.1.0",
|
|
81
|
+
"rollup": "^4.62.2",
|
|
82
|
+
"rollup-plugin-dts": "6.4.1",
|
|
83
|
+
"typescript": "~5.8.3",
|
|
84
|
+
"vite": "^7.3.7",
|
|
85
|
+
"vitest": "^4.1.12"
|
|
86
|
+
}
|
|
87
|
+
}
|