Library for building HTML in Kotlin
npm install kotlinx-htmlkotlin
window.setInterval({
val myDiv = document.create.div("panel") {
p {
+"Here is "
a("https://kotlinlang.org") { +"official Kotlin site" }
}
}
document.getElementById("container")!!.appendChild(myDiv)
document.getElementById("container")!!.append {
div {
+"added it"
}
}
}, 1000L)
`
Stream
You can build HTML directly to Writer (JVM only) or Appendable (both JVM and JS)
`kotlin
System.out.appendHTML().html {
body {
div {
a("https://kotlinlang.org") {
target = ATarget.blank
+"Main site"
}
}
}
}
``