Skip to content

Convert HTML to Attributed String #379

Description

@photos

Hi,

I'm trying to convert an HTML snippet with styles and links to an attributed string. What parsing approach would you recommend?

Here is the HTML I am trying to convert:

"<ol><li><strong>Bee Gees</strong> - <a href=\"https://www.youtube.com/watch?v=I_izvAbhExY\" target=\"_blank\"><em>Staying Alive</em></a></li><li><strong>Daft Punk</strong> - <a href=\"https://www.youtube.com/watch?v=yca6UsllwYs\" target=\"_blank\"><strong><em>Around the World</em></strong></a></li><li><strong>Kanye West</strong> - <a href=\"https://www.youtube.com/watch?v=mWtIxc38xNE\" target=\"_blank\"><strong>Flashing Lights</strong></a></li></ol>"

This has various phrases with nested emphasis+strong+ahref tags. I would like these nested tags to be converted to custom font styles for an attributed string.

I'm sure others have attempted this before - wondering if there is a recommended approach?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions