import { escapeHTML } from "./escapeHTML"; import { RTBlockNode, RTInlineNode, RTPreformattedNode, RTImageNode, RTEmbedNode, RTLinkNode, LinkType, RichTextNodeType, } from "@prismicio/types"; import { asLink } from "../asLink"; import { LinkResolverFunction } from "../types"; export const getLabel = (node: RTBlockNode | RTInlineNode): string => { return "data" in node && "label" in node.data ? ` class="${node.data.label}"` : ""; }; export const serializeStandardTag = ( tag: string, node: RTBlockNode | RTInlineNode, children: string[], ): string => { return `<${tag}${getLabel(node)}>${children.join("")}${tag}>`; }; export const serializePreFormatted = (node: RTPreformattedNode): string => { return `
${escapeHTML(node.text)}`;
};
export const serializeImage = (
linkResolver: LinkResolverFunction${imageTag}
`; }; export const serializeEmbed = (node: RTEmbedNode): string => { return `