fn

createSchema

Build a Schema from node and mark spec maps.

Signature

ts
export function createSchema(input:{ ... }

Parameters

ParameterTypeDescription
input{ nodes: ReadonlyMap<string, NodeSpec>; marks: ReadonlyMap<string, MarkSpec>; }

Returns

Schema
PropertyTypeDescription
nodesReadonlyMap<string, NodeSpec>
marksReadonlyMap<string, MarkSpec>
nodeSpec(type: string) => NodeSpec | undefined
markSpec(type: string) => MarkSpec | undefined
defaultAttrs(type: string) => AttrsDefault attrs for a block type (all defaults applied).
coerceAttrs(type: string, attrs?: Attrs) => AttrsFill defaults and drop unknown keys for a block type.
defaultMarkAttrs(type: string) => AttrsDefault attrs for a mark type.
coerceMarkAttrs(type: string, attrs?: Attrs) => AttrsFill defaults and drop unknown keys for a mark type.