elemi 1.2.0-alpha

A simple HTML creation helper.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

elemi

Elemi is a tiny, dependency free library to make writing sanitized HTML and XML a bit easier.

Check the source code or the documentation to learn how to use it!

import elemi;

// HTML document
auto document = Element.HTMLDoctype ~ elem!"html"(

    elem!"head"(
        elem!"title"("Hello, World!"),
        Element.MobileViewport,
        Element.EncodingUTF8,
    ),

    elem!"body"(
        attr("class") = ["home", "logged-in"],

        elem!"main"(

            elem!"img"(
                attr("src") = "/logo.png",
                attr("alt") = "Website logo"
            ),

            // All input is sanitized.
            "<Welcome to my website!>"

        )

    ),

);

// An XML document too!
auto xml = Element.XMLDeclaration ~ elemX!("feed", `xmlns="http://www.w3.org/2005/Atom"`)(

    elemX!"title"("Example feed"),
    elemX!"subtitle"("Showcasing using elemi for generating XML"),
    elemX!"updated"("2021-10-30T20:30:00Z"),

    elemX!"entry"(
        elemX!"title"("Elemi home page"),
        elemX!("link", `href="https://github.com/Soaku/Elemi"`),
        elemX!"updated"("2021-10-30T20:30:00Z"),
        elemX!"summary"("Elemi repository on GitHub"),
        elemX!"author"(
             elemX!"Soaku",
             elemX!"soaku@samerion.com"
        )
    )

);
Authors:
  • soaku
Dependencies:
none
Versions:
1.2.2 2023-Feb-11
1.2.1 2022-Sep-07
1.2.0 2021-Nov-30
1.2.0-alpha 2021-Nov-30
1.1.0 2021-Oct-30
Show all 10 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 0 downloads total

Score:
0.3
Short URL:
elemi.dub.pm