✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Block Content to HTML - How to Stop the Output Being Wrapped in a Div?

5 replies
Last updated: Apr 30, 2021
Hey folks! Using
@sanity/block-content-to-html
and wondering how I can stop the output being wrapped in a div?
Apr 30, 2021, 5:55 PM
I’m not sure you can, unless I’m misreading the
className
details here .
Apr 30, 2021, 6:09 PM
To be honest I could probably deal if I could set the class(es) of the parent
Apr 30, 2021, 6:10 PM
Looks like to can set container: 'div' on the serializer, but probably won't work with a fragment.
Apr 30, 2021, 7:50 PM
I’m still struggling to get it, sorry.
Apr 30, 2021, 9:39 PM
I got it. To this:
const params = { blocks: value, serializers}
I added
{ className: 'my-class-here' }
Apr 30, 2021, 9:49 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?