Takes a Portable Text block and returns a nested tree of nodes optimized for rendering
in HTML-like environments where you want marks/annotations to be nested inside of eachother.
For instance, a naive span-by-span rendering might yield:
<strong>This block contains </strong> <strong><ahref="https://some.url/">a link</a></strong> <strong> and some bolded and </strong> <em><strong>italicized text</strong></em>
...whereas an optimal order would be:
<strong> This block contains <ahref="https://some.url/">a link</a> and some bolded and <em>italicized text</em> </strong>
Note that since "native" Portable Text spans cannot be nested,
this function returns an array of "toolkit specific" types:
@text and @span.
The toolkit-specific type can hold both types, as well as any arbitrary inline objects,
creating an actual tree.
Type Parameters
M extends PortableTextMarkDefinition = PortableTextMarkDefinition
Takes a Portable Text block and returns a nested tree of nodes optimized for rendering in HTML-like environments where you want marks/annotations to be nested inside of eachother. For instance, a naive span-by-span rendering might yield:
...whereas an optimal order would be:
Note that since "native" Portable Text spans cannot be nested, this function returns an array of "toolkit specific" types:
@text
and@span
.The toolkit-specific type can hold both types, as well as any arbitrary inline objects, creating an actual tree.