Guides
Keep storage in Markdown without fighting the editor. Conceptual background: Markdown isomorphism.
const ed = new Editor(el, mdToDoc(saved ?? ''), {
onChange: (d) => {
// debounce as needed
api.save(docToMd(d))
},
})
This is the main reason markloom does not “pretty-print the whole file” every keystroke.
| Feature | Serialization sketch |
|---|---|
| Callout | <div data-callout data-variant> island |
| Mention / date | <span data-mention …> |
| Math | data-math + LaTeX attrs |
| Embed | data-embed kind |
| Comments | marks + side channel; HTML data-comment |
Opaque atoms (images, tables) get vacuum paragraphs so a real caret can land between them. Those gap paragraphs do not serialize — round-trip stays isomorphic for storage.
The package ships MD fixture round-trip tests under __tests__/__fixtures__/md-roundtrip/.
Prefer fixture snapshots when changing serializers.