I am using Kotlin's html library kotlinx.html
for dynamic html building.
For debugging proposes I want to write a tag as a raw html. But I can't find any method that would do it. Simple text addition replaces characters like <
to their codes, so it does not help:
StringBuilder().appendHTML().html {
body {
+"""
<form action="http://courier-voddan.rhcloud.com/customer/new_task" method="get">
get=form
id=3333
<button type="submit">ok</button>
</form>
""".trimIndent()
}
}
Simply use unsafe
inside your tag to prevent HTML encoding.
body {
unsafe {
+"""<form class="formClass"/>"""
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With