Get Started
markloom/view is a fully controlled Preact editor.
The DOM is a projection; Steps are the only way the document changes.
import { Editor } from 'markloom/view'
import 'markloom/view/theme.css'
const ed = new Editor(el, doc, {
onChange: (d) => { /* persist */ },
})
/) — block transforms + insert table / image / hr / callout / …| Option | Purpose |
|---|---|
onChange | Doc committed after edits |
editable / setEditable | Read-only gate |
extensions | Default markloomKit(); filter or extend |
ai | AI transport + chrome |
collab | { url, room, name? } |
toc | Left outline rail |
mentionSource | @ candidates (person / date) |
nodeViews | e.g. replace code block renderer |
Full list: Editor options.
import 'markloom/view/theme.css'
// when using AI chrome:
import 'markloom/ai/theme.css'
Tokens use CSS variables (--markloom-accent, etc.).
Host apps can override without forking the stylesheet.
ed.focus()
ed.setEditable(false)
// collab client when enabled:
ed.collab?.close()
// destroy when unmounting host
ed.destroy?.()