# Extension model

Learn how behavior, document structures and text formatting join an editor.

Installed extensions determine whether an editor supports headings, bold or shortcuts. Each extension groups a feature's configuration, commands and lifecycle for Editor to consume.

## Choose an extension kind

| Add | Use | Examples |
| --- | --- | --- |
| Behavior without new structure | `Extension` | Shortcuts, history |
| A content structure | `Node` | Paragraphs, images, note groups |
| Formatting attached to text | `Mark` | Bold, italic, links |

StarterKit combines common extensions. Use it directly or configure its features for your product.

## Start with a shortcut

To bind `Mod-Shift-b` to Bold, add behavior rather than a new node. `core/shortcuts.ts` uses `Extension.create()` and calls the existing `toggleBold()` in `addKeyboardShortcuts()`.

### core/shortcuts.ts

```ts
import { Extension } from "@quirekit/core";

/** A host-authored behavior extension using the same typed command registry as the toolbar. */
export const writingShortcuts = Extension.create({
  name: "writingShortcuts",
  /** @returns A keyboard binding that participates in the editor's existing history. */
  addKeyboardShortcuts() {
    return { "Mod-Shift-b": () => this.editor?.commands.toggleBold() ?? false };
  },
});

```

`this.editor` is the receiving editor. The command uses its selection and undo history. Install the extension in the creation-time `extensions` array.

## Configure and extend

`.configure(options)` changes public options; `.extend(config)` adds or replaces behavior. `addOptions()` supplies defaults, while `addStorage()` holds instance runtime state.

Options and storage are not document data. Persisted business fields belong in node or mark attributes. Implement a command in the [behavior tutorial](/en/guide/behavior), then explore [input rules and PM plugins](/en/guide/rules) and [NodeViews](/en/guide/node-view).

## Add other content capabilities

A Node defines content structure. HTML output, Canvas layout, structured selection, DOCX conversion and AI reading require their respective implementations.

Follow the [note-group tutorial](/en/build/extension) for a first content extension. Find existing features in [plugins](/en/plugins), and hooks and types in [extension API](/en/api/extensions).
