ch4rl3x / HtmlText

Jetpack Compose HtmlText
Apache License 2.0
128 stars 18 forks source link

Add support for String input instead of textId #1

Closed moeindev closed 2 years ago

ch4rl3x commented 2 years ago

Hey. Sry but that is not as easy as it seams to be. The StringRes ist used with getText instead of getString to get a Spanned

https://github.com/ch4rl3x/HtmlText/blob/4fc1409214858134100178d54b8ea0b049ccc9bb/html-text/src/main/java/de/charlex/compose/HtmlText.kt#L116

The only way would be to support CharSequence instead of textId, but the "Html" content won't work, until you create your own Spanned which is a CharSequence.

Feel free to add a StringExtension which creates a Spanned from a HtmlString. If we have a working StringExtension, than we could support String input

moeindev commented 2 years ago

I will take a look at this weekend to see if I can do anything