Thread
#compose
    ziv kesten

    ziv kesten

    11 months ago
    Is there a
    Text
    implementation that can take
    SpannedString
    ?
    ziv kesten

    ziv kesten

    11 months ago
    This returns
    AnnotatedString
    i couldn't find a way to work with
    SpannedString
    Johan Reitan

    Johan Reitan

    11 months ago
    Some of the examples there work with
    Spanned
    , that
    SpannedString
    implements. I just thought it could point you in the right direction 🙂
    ziv kesten

    ziv kesten

    11 months ago
    Alright, thanks man!
    Alexander Karkossa

    Alexander Karkossa

    11 months ago
    I have created a HtmlText composable to show simple html formatted text from string resources. https://github.com/ch4rl3x/HtmlText
    ziv kesten

    ziv kesten

    11 months ago
    That's amazing! Great work!
    Michael Paus

    Michael Paus

    11 months ago
    It’s a pity that this is Android only. What about Compose desktop?
    Alexander Karkossa

    Alexander Karkossa

    11 months ago
    @Michael Paus You are invited to make a pull request to remove the dependencies to Android 😉
    ziv kesten

    ziv kesten

    11 months ago
    Inside the lib it's basically one composeable, you can look at it and remove all android related stuff.
    Michael Paus

    Michael Paus

    11 months ago
    The default OSS answer 😉 (But I am actually just looking at the code.)
    Alexander Karkossa

    Alexander Karkossa

    11 months ago
    This is not quite as easy as it seems at first. The core of the library is not to provide the composable function, but the toAnnotatedString function, which turns an android string resource into an annotated string via getText. For this purpose androidx.core is used here.
    Michael Paus

    Michael Paus

    11 months ago
    Right 😭
    Alexander Karkossa

    Alexander Karkossa

    11 months ago
    I'm not as familiar with compose-desktop as I am with compose, so I'm running out of ideas here.
    t

    tad

    11 months ago
    You'd use something like JSoup to parse an HTML string to a document fragment and build up an AnnotatedString by traversing the elements.