https://github.com/daymxn/khtml
Lightweight HTML5 DSL written in pure Kotlin!
https://github.com/daymxn/khtml
documentation dsl functional gradle hacktoberfest hacktoberfest-2022 hacktoberfest2022 html html5 jvm kotlin lightweight modular
Last synced: 11 months ago
JSON representation
Lightweight HTML5 DSL written in pure Kotlin!
- Host: GitHub
- URL: https://github.com/daymxn/khtml
- Owner: daymxn
- License: apache-2.0
- Created: 2022-07-26T01:38:19.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-05T00:09:31.000Z (almost 4 years ago)
- Last Synced: 2025-07-14T20:32:59.799Z (11 months ago)
- Topics: documentation, dsl, functional, gradle, hacktoberfest, hacktoberfest-2022, hacktoberfest2022, html, html5, jvm, kotlin, lightweight, modular
- Language: Kotlin
- Homepage: https://khtml.daymxn.com/
- Size: 156 KB
- Stars: 6
- Watchers: 2
- Forks: 5
- Open Issues: 95
-
Metadata Files:
- Readme: README.md
- Contributing: contributing.md
- License: LICENSE
Awesome Lists containing this project
README





# kHTML
Super light-weight HTML5 DSL written in pure Kotlin!
Learn how to use kHTML by reading our wiki [here.](https://khtml.daymxn.com/en/overview/)
## Example
```kotlin
fun makeUserDisplay(users: List) =
html {
body {
this write users.map { userEntry(it) }
}
}
fun userEntry(name: String) =
div {
p {
this write "Hello! My name is $name"
}
}
```
## Installation
Unfortunately, kHTML artifacts are not currently available on maven central. The reasoning for this can be found [here.](https://github.com/daymxn/kHTML/issues/1)
For the time being, you can pull kHTML artifacts from GitHub Packages.
**_Gradle_**
```kotlin
implementation("com.daymxn:khtml:1.0.0")
```
**_Maven_**
```xml
com.daymxn
khtml
1.0.0
```
## Notable features
- 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
## Roadmap
- Add unit tests
- Add support for additional common HTML5 elements
- Extend elements to offer _all_ props typically offered from their HTML counterpart
## Getting Started
[Basics](https://khtml.daymxn.com/en/getting%20started/basics/)
[Adding Text](https://khtml.daymxn.com/en/getting%20started/text/)
[Functional Elements](https://khtml.daymxn.com/en/getting%20started/functional-elements/)
[More Functional Elements](https://khtml.daymxn.com/en/getting%20started/functional-elements-again/)
[Configuring Elements](https://khtml.daymxn.com/en/getting%20started/configuring-elements/)
[Adding custom Tags](https://khtml.daymxn.com/en/getting%20started/adding-custom-tags/)
## Contributing
Contributions are always welcome!
See [contributing.md](/contributing.md) for ways to get started.
## License
[Apache 2.0](/LICENSE)