How to use the prismic-dom.RichText.asHtml function in prismic-dom

To help you get started, we’ve selected a few prismic-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wellcometrust / wellcomecollection.org / server / services / prismic-parsers.js View on Github external
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();
}
github wellcometrust / wellcomecollection.org / common / services / prismic / parsers.js View on Github external
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();
}
github everydayhero / prismic-utils / source / utils / index.js View on Github external
export const prismicRichTextAsHTML = (content, linkResolver, htmlSerializer) => HTMLRichText.asHtml(content, linkResolver, htmlSerializer)
github wellcometrust / wellcomecollection.org / server / filters / prismic.js View on Github external
export function prismicAsHtml(content) {
  return RichText.asHtml(content);
}

prismic-dom

Set of helpers to manage Prismic data

Apache-2.0
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis