normalizeBlock
normalizeBlock(
node
,options
):Omit
<TypedObject
|PortableTextTextBlock
<TypedObject
|PortableTextSpan
>,"_key"
> &object
Defined in: block-tools/src/util/normalizeBlock.ts:48
Normalizes a block by ensuring it has a _key
property. If the block is a
portable text block, additional normalization is applied:
- Ensures it has
children
andmarkDefs
properties - Ensures it has at least one child (adds an empty span if empty)
- Joins sibling spans that has the same marks
- Removes decorators that are not allowed according to the schema
- Removes marks that have no annotation definition
Parameters
Section titled “Parameters”The block to normalize
options
Section titled “options”BlockNormalizationOptions
= {}
Options for normalization process. See BlockNormalizationOptions
Returns
Section titled “Returns”Omit
<TypedObject
| PortableTextTextBlock
<TypedObject
| PortableTextSpan
>, "_key"
> & object
Normalized block