Super light-weight HTML5 DSL written in pure Kotlin!
Learn how to use kHTML by reading our wiki here.
fun makeUserDisplay(users: List<String>) =
html {
body {
this write users.map { userEntry(it) }
}
}
fun userEntry(name: String) =
div {
p {
this write "Hello! My name is $name"
}
}
Unfortunately, kHTML artifacts are not currently available on maven central. The reasoning for this can be found here.
For the time being, you can pull kHTML artifacts from GitHub Packages.
Gradle
implementation("com.daymxn:khtml:1.0.0")
Maven
<dependency>
<groupId>com.daymxn</groupId>
<artifactId>khtml</artifactId>
<version>1.0.0</version>
</dependency>
- 1:1 Mapping between HTML elements and Kotlin classes
- Easily compile kHTML elements to string representations of HTML5
- Functional element creation support
- Fully documented API
- Modular API to allow easy extendability
- Lightweight DSL
- Add unit tests
- Add support for additional common HTML5 elements
- Extend elements to offer all props typically offered from their HTML counterpart
Contributions are always welcome!
See contributing.md for ways to get started.