UNPKG

@prismicio/helpers

Version:
21 lines (20 loc) 1.27 kB
import { RichTextField } from "@prismicio/types"; import { HTMLFunctionSerializer, HTMLMapSerializer, LinkResolverFunction } from "./types"; /** * The return type of `asHTML()`. */ type AsHTMLReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField ? string : null; /** * Serializes a rich text or title field to an HTML string * * @param richTextField - A rich text or title field from Prismic * @param linkResolver - An optional link resolver function to resolve links, * without it you're expected to use the `routes` options from the API * @param htmlSerializer - An optional serializer, unhandled cases will fallback * to the default serializer * * @returns HTML equivalent of the provided rich text or title field * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript} */ export declare const asHTML: <Field extends [] | [import("@prismicio/types").RTNode, ...import("@prismicio/types").RTNode[]] | null | undefined>(richTextField: Field, linkResolver?: LinkResolverFunction<string> | null, htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer | null) => AsHTMLReturnType<Field>; export {};