Note: reimplementing Description -> AnnotatedString is going to be a tough task, considering how complicated TextLinkifier is: https://github.com/TeamNewPipe/NewPipe/blob/9d6ac67c46a6cc55e03dec0599d8070f7430098d/app/src/main/java/org/schabi/newpipe/util/text/TextLinkifier.java
Originally posted by @Stypox in #11060 (comment)
|
fun rememberParsedDescription(description: Description): AnnotatedString { |
|
// TODO: Handle links and hashtags, Markdown. |
|
return remember(description) { |
|
if (description.type == Description.HTML) { |
|
val styles = TextLinkStyles(SpanStyle(textDecoration = TextDecoration.Underline)) |
|
AnnotatedString.fromHtml(description.content, styles) |
|
} else { |
|
AnnotatedString(description.content) |
|
} |
|
} |
|
} |
Originally posted by @Stypox in #11060 (comment)
NewPipe/app/src/main/java/org/schabi/newpipe/ui/components/common/DescriptionText.kt
Lines 35 to 45 in fdf36cb