Open AmirHossein1372 opened 4 years ago
you could use .textTransforms
to do something like
let liStyle = Style {
...
$0.textTransforms = [
.custom { "\n• " + $0 },
]
}
In general, I do think it would be nice to have access to some defaults or out-of-the-box configuration for handling stuff like <li>
and <p>
tags, which I'm currently wrestling with.
Hi, I'm trying to parse an html text in a way that each list item (\<li> tag) begins at the new line.
I've tried:
let text = "<ul><li>First</li><li>Second</li><li>Third</li></ul>"
let style = Style { $0.color = UIColor.black }
let liStyle = Style { $0.color = UIColor.green }
let htmlStyle = StyleXML(base: style, ["li": liStyle])
label.attributedText = text.set(style: htmlStyle)
And the output is:
Is there any way to style them like:
Thanks, best wishes.