Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert HTML to Attributed String #379

Open
photos opened this issue Oct 9, 2019 · 1 comment
Open

Convert HTML to Attributed String #379

photos opened this issue Oct 9, 2019 · 1 comment

Comments

@photos
Copy link

photos commented Oct 9, 2019

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?

@zhgchgli0718
Copy link

I made a new parser that is based on pure String Regexr, feel free the check my works :)
https://github.com/ZhgChgLi/ZMarkupParser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants