Hi, everyone!
I'm trying to use kotlinx-html for building formatted messages for Telegram.
Telegram supports only limited number of tags (docs),
So basically, I need to produce a kinda-html-document without a top level tag.
And I'm struggling with finding a nice way to do that 🙂
The best I've come up with so far is something like that:
Copy code
buildString {
appendHTML().b { +"Here is a list of users" }
append("\n\n")
for (user in users) {
appendHTML().b { +"${user.type}: "}
append("${user.login}\n")
}
}
Maybe anyone has a better example?
Evgeniy Zemtsov
05/18/2023, 12:55 PM
Maybe there is a way to wrap everything into dummy div, then acquire and render it's contents without a tag itself.
I've tried looking into that, but quickly drowned in org.w3c.dom.* ðŸ«
d
dmcg
10/14/2024, 4:17 PM
I’m facing a similar issue. I have a table renderer
Copy code
fun FlowContent.generateStockListTable(model: StockListViewModel) {
table {
tr {...
and I’d like to be able to render just the table and its children at the top level as string.
I can say