Skip to main content

I have a TextNode that can include Rich Text. What would be the best approach to recognise style changes such as bold text, line breaks (These come as \n in the .characters property of the node), bullet points, etc.

I’ve tried various methods, I managed to identify bold text using getStyledTextSegments
https://www.figma.com/plugin-docs/api/properties/TextNode-getstyledtextsegments/

But I didn’t find a way to detect when the TextNode has bullet points.

I basically need this because I’m converting the TextNode to HTML, so I need to be able to reliably identify every rich text property.

Thanks in advance.

Add to the StyledTextSegment array all the necessary properties whose values you want to obtain using the method you mentioned.

For example, the listOptions property is responsible for the list style.

Please refer to these documentation pages:

https://www.figma.com/plugin-docs/api/properties/TextNode-getstyledtextsegments/

https://www.figma.com/plugin-docs/api/StyledTextSegment/