Git Product home page Git Product logo

khtml's Introduction

kHTML logo

GitHub release (latest by date) GitHub last commit (branch) GitHub issues GitHub code size in bytes GitHub

kHTML

Super light-weight HTML5 DSL written in pure Kotlin!

Learn how to use kHTML by reading our wiki here.

Example

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"
        }
    }

Installation

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>

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

Adding Text

Functional Elements

More Functional Elements

Configuring Elements

Adding custom Tags

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

License

Apache 2.0

khtml's People

Contributors

daymxn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.