https://kotlinlang.org logo
Title
s

sanao

05/11/2023, 12:14 PM
Hi, I have a question: does anyone know if there is a Composable function that will display HTML code written in String, such as "<h1>Hello World</h1>"? The Text Composable function would just display "<h1>Hello World</h1>". I want to display "Hello World" in the font size of the h1 tag.
s

sanao

05/11/2023, 12:28 PM
It worked fine! Thanks for answering!!!
c

CLOVIS

05/12/2023, 12:43 PM
Be very careful with what you use it for, though. This is the doorway to all HTML/JS injections. Never use it with something that the user sent.
e

ephemient

05/12/2023, 12:46 PM
I agree. HTML sanitization is possible but quite tricky, I would avoid having to deal with it if at all possible
c

CLOVIS

05/12/2023, 12:49 PM
^ and it's much, much harder than it looks like it is