Architecture
prosekit/core is a small, type-safe layer on top of ProseMirror. This page shows how every editor is put together.
The mental model
Section titled “The mental model”You combine extensions with union(...) and pass the result to createEditor({ extension }). You get back an Editor whose commands, nodes, marks, and view are typed from the extensions you passed in.
What an extension is
Section titled “What an extension is”An extension is an object that holds part of the editor: a schema, commands, keymaps, plugins, or any mix of these. You never build one by hand. You call a define* function, and you combine extensions with union(...). The functions come at different levels of abstraction. Here are three examples:
defineNodeSpec()wraps a single ProseMirror node spec and adds nothing else.defineHeading()bundles theheadingnode spec with its commands, keymaps, and input rules, so one call gives you the full heading feature.defineBasicExtension()is a pre-bundled set of extensions that gives you a working editor out of the box including paragraphs, headings, lists, code blocks, and more.
Pick the level that fits your need. Most app code starts with defineBasicExtension() and adds individual feature extensions.
Where to go next
Section titled “Where to go next”- The Editor: what the
Editorinstance exposes. - Extensions: how to compose them.
- Schema: nodes and marks.
- Commands: how to run and check commands.
- Content: convert between JSON, HTML, and ProseMirror nodes.
- Views: node views, mark views, decorations.