I would like to use rich text component and want to display it in mobile device(iOS/Android Native). I am consuming API to get all the data. The format for Rich text component is not easy to use. Is there any library/SDK which we can use on both platform which will convert this structured text(array of elements) to either HTML or AttributedString which are supported by both platform(Swift/Kotlin)
Thanks for reaching out to us.
You can translate these raw structured text data into either HTML or plain text by using
asText() property from
@prismicio/helpers - v2 library.
@prismicio/helpers - v2 library in the technical reference article: @prismicio/helpers Technical Reference - Documentation - Prismic
Let me know if you have any further questions.
Hi @Priyanka ,
Thank you for reply, but as I said I am looking for mobile solution(iOS/Android). Is there any sdk which will convert this structured text into html? If not we are having middleware written in java, can we use any java lib(jar file) to convert this?
Do you have any update for me regarding the solution?
I apologize for the late response I was on vacation.
Prismic doesn't have any SDK that converts the structured text into HTML except the library I suggested in my previous response.
You can provide your own HTML Serializer. An HTML Serializer defines how Rich Text content is converted and rendered on your website. Learn more about HTML serializers in the following article: HTML Serializer - Documentation - Prismic