@portabletext/to-html - v3.0.0
    Preparing search index...

    Interface PortableTextHtmlComponents

    Object definining the different component functions to use for rendering various aspects of Portable Text and user-provided types.

    interface PortableTextHtmlComponents {
        types: Record<string, PortableTextTypeComponent | undefined>;
        marks: Record<string, PortableTextMarkComponent | undefined>;
        block:
            | PortableTextBlockComponent
            | Record<string, undefined | PortableTextBlockComponent>;
        list:
            | PortableTextListComponent
            | Record<string, undefined | PortableTextListComponent>;
        listItem:
            | PortableTextListItemComponent
            | Record<string, undefined | PortableTextListItemComponent>;
        hardBreak: false | (() => string);
        escapeHTML: (html: string) => string;
        unknownMark: PortableTextMarkComponent;
        unknownType: PortableTextComponent<UnknownNodeType>;
        unknownBlockStyle: PortableTextComponent<
            PortableTextBlock<
                PortableTextMarkDefinition,
                ArbitraryTypedObject
                | PortableTextSpan,
                string,
                string,
            >,
        >;
        unknownList: PortableTextComponent<ToolkitPortableTextList>;
        unknownListItem: PortableTextComponent<
            PortableTextListItemBlock<
                PortableTextMarkDefinition,
                PortableTextSpan,
                string,
                string,
            >,
        >;
    }
    Index

    Properties

    types: Record<string, PortableTextTypeComponent | undefined>

    Object of component functions that renders different types of objects that might appear both as part of the blocks array, or as inline objects inside of a block, alongside text spans.

    Use the isInline property to check whether or not this is an inline object or a block

    The object has the shape {typeName: ComponentFn}, where typeName is the value set in individual _type attributes.

    marks: Record<string, PortableTextMarkComponent | undefined>

    Object of component functions that renders different types of marks that might appear in spans.

    The object has the shape {markName: ComponentFn}, where markName is the value set in individual _type attributes, values being stored in the parent blocks markDefs.

    block:
        | PortableTextBlockComponent
        | Record<string, undefined | PortableTextBlockComponent>

    Object of component functions that renders blocks with different style properties.

    The object has the shape {styleName: ComponentFn}, where styleName is the value set in individual style attributes on blocks.

    Can also be set to a single component function, which would handle block styles of any type.

    list:
        | PortableTextListComponent
        | Record<string, undefined | PortableTextListComponent>

    Object of component functions used to render lists of different types (bulleted vs numbered, for instance, which by default is <ul> and <ol>, respectively)

    There is no actual "list" node type in the Portable Text specification, but a series of list item blocks with the same level and listItem properties will be grouped into a virtual one inside of this library.

    Can also be set to a single component function, which would handle lists of any type.

    listItem:
        | PortableTextListItemComponent
        | Record<string, undefined | PortableTextListItemComponent>

    Object of component functions used to render different list item styles.

    The object has the shape {listItemType: ComponentFn}, where listItemType is the value set in individual listItem attributes on blocks.

    Can also be set to a single component function, which would handle list items of any type.

    hardBreak: false | (() => string)

    Component to use for rendering "hard breaks", eg \n inside of text spans Will by default render a <br />. Pass false to render as-is (\n)

    escapeHTML: (html: string) => string

    Used when rendering text nodes to HTML

    Component function used when encountering a mark type there is no registered component for in the components.marks prop.

    Component function used when encountering an object type there is no registered component for in the components.types prop.

    unknownBlockStyle: PortableTextComponent<
        PortableTextBlock<
            PortableTextMarkDefinition,
            ArbitraryTypedObject
            | PortableTextSpan,
            string,
            string,
        >,
    >

    Component function used when encountering a block style there is no registered component for in the components.block prop. Only used if components.block is an object.

    unknownList: PortableTextComponent<ToolkitPortableTextList>

    Component function used when encountering a list style there is no registered component for in the components.list prop. Only used if components.list is an object.

    unknownListItem: PortableTextComponent<
        PortableTextListItemBlock<
            PortableTextMarkDefinition,
            PortableTextSpan,
            string,
            string,
        >,
    >

    Component function used when encountering a list item style there is no registered component for in the components.listItem prop. Only used if components.listItem is an object.