Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function asHtml(maybeContent: any) {
// Prismic can send us empty html elements which can lead to unwanted UI in templates.
// Check that `asText` wouldn't return an empty string.
const isEmpty = !maybeContent || (asText(maybeContent) || '').trim() === '';
return isEmpty ? null : RichText.asHtml(maybeContent, linkResolver).trim();
}
export function asHtml(
maybeContent: ?HTMLString,
htmlSerializer?: HtmlSerializer
) {
// Prismic can send us empty html elements which can lead to unwanted UI in templates.
// Check that `asText` wouldn't return an empty string.
const isEmpty = !maybeContent || (asText(maybeContent) || '').trim() === '';
return isEmpty
? null
: RichText.asHtml(maybeContent, linkResolver, htmlSerializer).trim();
}
export const prismicRichTextAsHTML = (content, linkResolver, htmlSerializer) => HTMLRichText.asHtml(content, linkResolver, htmlSerializer)
export function prismicAsHtml(content) {
return RichText.asHtml(content);
}