@sanity/block-content-to-react
Advanced tools
Changelog
3.0.0 - 2021-05-14
div
with a message noting that a serializer is missing. A message will also be logged to the console. To use the old behavior of throwing un known types, pass ignoreUnknownTypes: false
as a property.markFallback
serializer has been renamed to unknownMark
to align with the new unknownType
serializer for blocks.Changelog
2.0.1 - 2018-07-09
renderContainerOnSingleChild
to force container to be rendered even on single-child resultsChangelog
2.0.0 - 2018-07-04
The default list item serializer now calls the block serializer to render children, unless the node style is normal
.
In other words: If a list item is marked as a heading, it would previously be rendered simply as <li>Text</li>
, where it will now render as <li><h1>Text</h1></li>
. Normal list items will render simply as <li>Text</li>
.
This can be considered as a bugfix, but also a breaking change. Should you want the old behavior back, you can override the listItem
serializer as below:
const ListItemRenderer = props => <li>{props.children}</li>
<BlockContent
blocks={input}
serializers={{listItem: ListItemRenderer}}
/>