What do you think of adding support for custom tag handlers that can support custom styling like:
// per htmlToAnnotatedString
htmlToAnnotatedString(
html,
renderers = listOf<TagRenderer>(...) // list if custom tag handlers
)
// or globally
HTMLConverterCompose.registerRenderers(listOf<TagRenderer>(....))
where each handler get the tag name, the attributes and the text and returns an AnnotatedString, something like e.g.
interface TagRenderer {
fun handles(tag: String, attributes: List<String>): Boolean // function to decide if this renderer can handle a tag
fun render(tag: String, attributes: List<String>, text: String): AnnotatedString // function to actually convert the tag to an AnnotatedString
}
Idee
I could write my own extensions or you could even provide modules like a color span renderer like e.g. <span style="color:blue"> (that's what I want to have) and similar.
What do you think of adding support for custom tag handlers that can support custom styling like:
where each handler get the tag name, the attributes and the text and returns an
AnnotatedString, something like e.g.Idee
I could write my own extensions or you could even provide modules like a color span renderer like e.g.
<span style="color:blue">(that's what I want to have) and similar.