Giter Club home page Giter Club logo

htmeta's Introduction

This crates implements a (simple) flavour of KDL called htmeta. This dialect's purpose is to allow a straightforward representation of HTML.

Format

As KDL is already very similar to HTML semantically, htmeta only adds 2 things:

  • A way to differentiate true text content to be shown in HTML.
  • Variables to reduce repetition.

Text nodes

Text nodes are creatively named text and they can only have one positional argument, which is the text to be directly pasted into the resulting HTML.

Example:

html {
    body {
        h1 {
            text "Title"
        }
    }
}

Results in:

<html>
    <body>
        <h1>
            Title
        </h1>
    </body>
</html>

Variables

If you ever used CSS-based frameworks like TailwindCSS or Bootstrap, you know how tedious it is to type the same classes over and over again. Hence, htmeta implements a simple variable mechanism that reduces duplication.

Example:

html {
    head {
        meta charset="utf-8"
        // Includes tailwindcss
        script src="https://cdn.tailwindcss.com"
    }
    body {
        // creates a variable called `$btn_class`
        $btn_class "border-1 rounded-lg"

        // Value of `$btn_class` is reused inside these buttons:
        button class="$btn_class ml-4"
        bttton class="$btn_class mr-4"
    }
}

Results in:

<html>
    <head>
        <meta charset="utf-8"/>
        <script src="https://cdn.tailwindcss.com"></script>
    </head>
    <body>
        <button class="border-1 rounded-lg ml-4"></button>
        <bttton class="border-1 rounded-lg mr-4"></bttton>
    </body>
</html>

htmeta's People

Contributors

diegovsky avatar

Watchers

 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.