I
AttrSpec
Specification for a single attribute: default, requiredness, validation.
interface AttrSpec<V extends AttrValue = AttrValue>
| Property | Type | Default | Description |
|---|
default?readonly | V | — | — |
required?readonly | boolean | — | — |
validate?readonly | (value: unknown) => boolean | — | — |
T
AttrsSpec
Map of attribute name → AttrSpec.
export type AttrsSpec = Readonly<Record<string, AttrSpec>>;
T
ContentKind
The content model of a block — a deliberately small, closed union instead of
ProseMirror's content-expression grammar (KISS).
- text: holds inline content; marks whitelists which marks may apply,
- container: holds child blocks (reserved; no default block uses it yet),
- atom: holds no editable content (image, divider).
export type ContentKind
= | { readonly kind: 'text'; readonly marks?: 'all' | 'none' | readonly string[] }
| { readonly kind: 'container'; readonly allow?: readonly string[]; readonly group?: string }
| { readonly kind: 'atom' };
I
ParseRule
A rule for parsing DOM (paste / HTML import) into a block or mark.
getAttrs receives a real HTMLElement (only ever called by the view); the
type reference is compile-time only and introduces no runtime DOM dependency.
| Property | Type | Default | Description |
|---|
tag?readonly | string | — | CSS selector to match, e.g. 'a[href]', 'strong', 'h1'. |
style?readonly | string | — | Inline-style match, e.g. 'font-weight=700' (reserved for M2). |
attrs?readonly | Attrs | — | Static attrs applied when the rule matches. |
getAttrs?readonly | (el: HTMLElement) => Attrs | false | null | — | Derive attrs from the matched element; false/null rejects the match. |
priority?readonly | number | — | Higher priority rules are tried first. |
T
DOMOutputHole
Placeholder marking where a node/mark's content should be spliced in.
export type DOMOutputHole = 0;
T
DOMOutputSpec
A serializable description of DOM output (ProseMirror-style), kept free of
real DOM so the schema layer stays pure. The view realizes it into elements.
- 'text' → a text node,
- ['tag', { attr: 'v' }, 0] → <tag attr="v">…content…</tag>,
- the attrs object is optional; 0 is the content hole.
The array part is an interface so the recursion (an element may contain nested
elements) is well-founded for the type checker.
export type DOMOutputSpec = string | DOMOutputArray;
I
NodeSpec
Schema contribution of a block type.
| Property | Type | Default | Description |
|---|
contentreadonly | ContentKind | — | Content model (text / container / atom). |
attrs?readonly | AttrsSpec | — | Attribute specs (defaults + validation). |
group?readonly | string | — | Group name for membership tests (e.g. 'block', 'list'). |
defining?readonly | boolean | — | Keep this block's type/identity when merged into (e.g. code-block). |
code?readonly | boolean | — | Raw multiline text: Enter inserts a newline instead of splitting (code-block). |
isolating?readonly | boolean | — | Selection and merge cannot cross this block's boundary. |
toDOM?readonly | (node: Node) => DOMOutputSpec | — | Serialize a node of this type to a DOM description (HTML export). |
parseDOM?readonly | readonly ParseRule[] | — | Rules for parsing DOM into a node of this type (paste / import). |
I
MarkSpec
Schema contribution of a mark type.
| Property | Type | Default | Description |
|---|
attrs?readonly | AttrsSpec | — | Attribute specs (defaults + validation), e.g. link href. |
inclusive?readonly | boolean | — | Whether typing at the mark's boundary extends it (bold yes, link no). |
excludes?readonly | readonly string[] | '_all' | — | Marks that cannot coexist with this one; '_all' excludes every other. |
rank?readonly | number | — | Nesting order in DOMOutputSpec: lower = outer wrapper. |
toDOMreadonly | (mark: Mark) => DOMOutputSpec | — | Serialize the mark to a DOM description wrapping its content. |
parseDOMreadonly | readonly ParseRule[] | — | Rules for parsing DOM into this mark (paste / import). |
I
Schema
The compiled schema: the set of known node/mark specs plus attribute
coercion helpers. Projected from the registry (the registry is the SSOT).
| Property | Type | Default | Description |
|---|
nodesreadonly | ReadonlyMap<string, NodeSpec> | — | — |
marksreadonly | ReadonlyMap<string, MarkSpec> | — | — |
nodeSpec | (type: string) => NodeSpec | undefined | — | — |
markSpec | (type: string) => MarkSpec | undefined | — | — |
defaultAttrs | (type: string) => Attrs | — | Default attrs for a block type (all defaults applied). |
coerceAttrs | (type: string, attrs?: Attrs) => Attrs | — | Fill defaults and drop unknown keys for a block type. |
defaultMarkAttrs | (type: string) => Attrs | — | Default attrs for a mark type. |
coerceMarkAttrs | (type: string, attrs?: Attrs) => Attrs | — | Fill defaults and drop unknown keys for a mark type. |