Hi, everyone! I'm trying to use kotlinx-html for ...
# kotlinx-html
e
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?
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
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
Copy code
createHTML().div {
            generateStockListTable(this@with)
        }
but how do I not have the div rendered?