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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

khtml's Issues

Add support for <span> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <s> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for HTML headings

You can learn about what exactly this element is, and what sort of props it has here: click me!

What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <mark> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <object> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <meta> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <sup> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <q> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <address> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <source> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <param> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <b> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <bdi> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for thematic breaks

You can learn about what exactly this element is, and what sort of props it has here: click me!

What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <ins> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <iframe> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <bdo> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for comments

You can learn about what exactly this element is, and what sort of props it has here: click me!

This will probably need to be implemented as a TextLiteral

What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <rp> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <rt> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <strong> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <i> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <abbr> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <meter> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <video> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <blockquote> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <code> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <del> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <samp> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <noscript> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <wbr> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <dfn> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <embed> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <time> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <ruby> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <small> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <u> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <track> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <var> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <audio> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <style> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <cite> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <kbd> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <sub> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <nav> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <template> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Migrate Artifacts to Public Repository

Currently, the artifacts are being published on Github Packages exclusively. Github Packages would be a great permanent avenue if it wasn't for the single major drawback:

Github Packages require PATs from consumers. This is very unintuitive, and tbh very verbose.

Ideally, we'd publish the artifacts to Maven Central- but I'm not comfortable with one's ability to control their own artifacts on Maven Central. My current intention is to either create some homebrew for my own public artifact repository or find a reliable service I'm more comfortable with. One that only requires you to add a single repository to use.

Add support for <progress> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <em> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

Add support for <pre> elements

You can learn about what exactly this element is, and what sort of props it has here: click me!
What we want:

  • builder variants for each tag
  • element variants for each tag
  • All props defined in the above link are supported
  • It follows standard practices for this repo
  • It has proper KDoc annotation, in a similar style to the others
  • The code is idiomatic and not verbose

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.