I am attempting to use Prismic with Astro, and within a template to render a rich text field. using @prismicio/helpers
and .asHTML(). However, what is happening is that the html tags in the output are escaped, so they are shown in the browser, instead of actually rendering them as HTML.
For instance, in my data object, I have this field
text_item_1: [
{ type: 'heading3', text: 'Our Clients', spans: [Array] },
{
type: 'paragraph',
text: 'We work with Manufacturers, Fabricators, Installers, Inventors, and Machine Shops who need a better laser mark, shorter lead times, and cost-effective pricing.',
spans: []
},
{ type: 'paragraph', text: ' ', spans: [] },
{
type: 'paragraph',
text: 'For these organizations, we are a reasonably priced, efficient, and high-quality operation that can guarantee an exceptional mark on various products and material types.',
spans: []
}
],
which is displayed in the browser as
<h3><strong>Our Clients</strong></h3><p>We work with Manufacturers, Fabricators, Installers, Inventors, and Machine Shops who need a better laser mark, shorter lead times, and cost-effective pricing.</p><p> </p><p>For these organizations, we are a reasonably priced, efficient, and high-quality operation that can guarantee an exceptional mark on various products and material types.</p>
and I'm using this code in the code fence in the component:
import * as prismicH from '@prismicio/helpers';
import {getFrontPage} from '../prismic.js';
const fp = await getFrontPage();
const data = fp.results[0].data;
const textItem1 = prismicH.asHTML(data.text_item_1);
per the docs. Am I using .asHTML() properly? Why are the tags being escaped? I don't have any links in my field, so I don't need to pass it a link resolver.