Thanks for your reply.
Yes. Seems there is some interesting nesting happening.
Strong > Label > Span
I originally filtered on the (type === span) from seeing the rich text data obj output pre serialisation in screenshot 1 from the first post.
Got around this with the following:
if (type === 'strong' && children[0]?.props?.className === 'rt-list-header') {
However running this again, seeing the nesting (console output below) was unexpected so wonder if this is what you would expect?
Your example didn't elaborate to which type a label would be attached, but it may be the case that a label is broken into its own type rather than a HTML tag type? I assumed property would just be attached to existing type.
See output from running through the nodes filtering by the 'Liability' title:
Update, after reviewing span array and the types associated with the [start: 0 - end: 9] items guess it makes sense (first post first screenshot). Only wonder is why/how an additional span tag gets created?
It sounds like you figured this out. For a Custom Label, the element.type === "label". So, in your HTML Serializer, you can do something along the lines of:
In the source code for the prismic-dom package, which includes a complete HTML Serializer, I can see that the label type renders a span tag, while the span type seems to just clean the HTML, without adding HTML tags: