BRE, BREM, and BREW — three editor modes, one API. Zero framework dependencies. Drop it into any project and start editing in minutes.
Block-based editor. Notion-style slash menu, drag-and-drop, columns, and all 14 block types.
Markdown-first. Write in plain Markdown and see it rendered instantly — no toolbar needed.
WYSIWYG. Familiar word-processor feel with inline formatting, tables, and rich embeds.
| Type | Description |
|---|---|
| paragraph | Plain text paragraph |
| heading | H1 – H6 headings |
| bulleted_list | Unordered list item |
| numbered_list | Ordered list item |
| todo | Checkbox / to-do item |
| quote | Block quotation |
| code | Fenced code block with language |
| formula | LaTeX math via KaTeX |
| image | Image with caption |
| video | YouTube / Vimeo embed |
| table | Grid table |
| divider | Horizontal rule |
| columns | Multi-column layout (BRE) |
| callout | Highlighted callout box |
| Method | Description |
|---|---|
| createEditor(el, options) | Mount an editor on a DOM element. Returns an editor instance. |
| editor.getJSON() | Return the current document as a serializable JSON object. |
| editor.setJSON(doc) | Hydrate the editor with a previously serialized document. |
| editor.getHTML() | Return sanitized HTML representing the current document. |
| editor.destroy() | Unmount the editor and clean up all event listeners. |
| Option | Type | Default | Description |
|---|---|---|---|
| mode | "BRE" | "BREM" | "BREW" | "BRE" | Editor variant to mount. |
| onChange | (doc) => void | undefined | Called whenever the document changes. |
| embedAllowlist | string[] | [] | Allowed embed URL origins for video blocks. |
| virtualize | boolean | false | Enable virtual rendering for very large documents. |
npm install bestricheditor import { createEditor } from 'bestricheditor';
import 'bestricheditor/dist/bre.css';
const editor = createEditor(document.getElementById('editor'), {
mode: 'BRE', // 'BRE' | 'BREM' | 'BREW'
onChange: (doc) => console.log(doc),
});
// Later:
const json = editor.getJSON(); // serialize
editor.setJSON(json); // restore
const html = editor.getHTML(); // sanitized HTML
editor.destroy(); // clean up