fn

normalizeDocument

Bring a document to canonical form against a schema: coerce attrs, normalize inline content, drop marks that are unknown or disallowed in their block, and drop blocks of unknown type. This is the single funnel every document passes through before it becomes writekit state.

Signature

ts
export function normalizeDocument(doc: WritekitDocument, schema: Schema): WritekitDocument{ ... }

Parameters

ParameterTypeDescription
docWritekitDocument
schemaSchema

Returns

WritekitDocument
PropertyTypeDescription
type'doc'
contentreadonly Node[]