OpenMarkdown Editor
@openmarkdown-dev/editor is a live-preview Markdown editor built on CodeMirror 6.
Headings, lists, tables, math, Mermaid diagrams, callouts and YAML properties render in place,
and the Markdown shows under the caret. It edits the Markdown source text itself, for a
lossless round-trip: open and save without editing, and the file is byte-for-byte what it was.
When you edit, only what you touched changes, with a few exceptions, each pinned by a test.
It is the editor inside the OpenMarkdown app, extracted as an MIT library.
Start here
Section titled “Start here”- Install the package and its CodeMirror peers.
- Mount your first editor in plain JavaScript.
- Use it in React or in any other framework.
Guides
Section titled “Guides”- The host:
EditorHost: the per-document callbacks (changes, links, images, outline). - The environment:
EditorEnvironment: per editor or as page defaults (color scheme, clipboard, links, spelling, keys). - Embed in a form or CMS field: auto height, labels, a string value, read-only, image uploads, replacing a CodeMirror editor.
- Theming: the
--ome-*custom properties. - UI language: English, Chinese, Japanese and Korean.
- Images: showing, pasting, dropping and resizing.
- Markdown syntax: what the editor renders, what it shows as written, and how math delimiters are read.
- Untrusted content: what the editor does with a document written by someone else.
- Server-side rendering: importing on the server, mounting in the browser.
- Self-hosting: building the editor into static files, without a bundler or a CDN, under a strict CSP.
Fidelity
Section titled “Fidelity”- What the editor changes in your file, and what it never changes.
- How we compared it with other editors: method, an example diff, the run date and the caveats.
Reference and examples
Section titled “Reference and examples”- The API reference is generated from the package's type declarations.
- Examples: small projects you can run, one per task.
- Live demo: the editor with a showcase document.
Code and app
Section titled “Code and app”The editor's source is in its public repository, and the same editor ships inside the OpenMarkdown app for macOS, Windows and Linux. To see it with files, folders and an agent around it, get the app or try the whole app in your browser.