Examples
Each one is a small project you can copy. Its page runs it above the source.
- Plain HTMLOne HTML file that loads the editor from a CDN with
<script type="module">and mounts it: no framework and no bundler, but the package must be on the CDN. - ReactThe editor inside a React component: mounted in
useEffect, destroyed on unmount, its text held in React state so the rest of the app can read and replace it. It uses the plain API; there is no React wrapper to install. - Reading modeOpen a document read-only in reading mode, then switch to live preview or plain source with
setMode. The document, selection and undo history stay as they were. - ThemingLight and dark follow the host's colour scheme through
configureEditorEnvironment, and the editor's colours, fonts and corners are restyled with--ome-*custom properties set on.ome-root. No stylesheet to import. - UI languageThe editor draws a few words of its own: the find panel, property controls, button tooltips. Pick their language (English, Chinese, Japanese or Korean) with
configureEditorEnvironment({ language }); the document text is yours and never translated. - Image uploadPaste or drop an image and the editor hands its bytes to your
uploadImagecallback, which stores them and returns the URL or path to link. The document needs no path, so this works for a CMS field or any text kept in a database.resolveImagemaps the link back to a URL the page can load. Here the "upload" stays in the browser tab. - Tables, diagrams and mathTables you edit cell by cell where they sit, Mermaid diagrams and LaTeX math rendered in place. The diagram and math renderers load only when a document first needs them.
- Save and loadRead a file's bytes with
openMarkdownFile, give the editor its text, and write it back withsaveMarkdownFile, which keeps the file's BOM and line endings. The page compares what Save would write with what was opened, byte by byte: open a file and save it without editing, and it is the same bytes. A file that is not valid UTF-8 is refused instead of opened.