Does preformatted not output br tags?

I'm upgrading a Next.js project to use @prismicio/react V2, from an older version using prismic-reactjs, and preserving all of the front-end as much as possible.

One of the I have a RichText component that is outputting preformatted code examples, using an html serializer according to the V2 docs. When applying highlight.js, all of the line breaks disappear, where there were previously honored before.

The CSS is 100% the same... the only difference that I can tell, is that when you view source, the line breaks (\n) from the content source are actually turned into <br> tags in the old version. In the new version, that is not the case, and only whitespace from those line breaks is rendered. I'm not sure if this is a Next issue (maybe SSR?) or a Prismic serialize issue...

Any pointers would be helpful.

I've discovered my own solution... the project (which I've inherited) had a utility JS function that was replacing new lines and break tags with empty strings, which was apparently needed in the older version of Next.js. This in turn affected the highlight.js plugin, which ultimately worked without this now-unhelpful "helper" function. Once again, deleting code saved the day.

1 Like