4 releases

0.1.3 Aug 3, 2023
0.1.2 Apr 23, 2023
0.1.1 Apr 21, 2023
0.1.0 Apr 21, 2023

#251 in Template engine

MIT license

44KB
1K SLoC

write-html

A simple and fast html generator

⚠️ This project is still in development and is not ready for production use, it is also not so fast, yet.

Example

use write_html::*;

let page = html!(
    (Doctype)
    html lang="en" {
        head {
            (DefaultMeta)
            title { "Website!" }
        }
        body {
            h1 #some-id { "H1" }
            h2 { "H2" }
            h3 { "H3" }
            p { "Paragraph" }
            ol {
                li { "Item 1" }
                li { "Item 2" }
                li style="color: red" { "Item 3" }
            }
            footer;
        }
    }
).to_html_string().unwrap();

lib.rs:

This crate provides a way to write HTML with as little overhead as possible.

This crate is still in development, and the API is not stable.

Example

use write_html::*;

let page = html!(
(Doctype)
html lang="en" {
head {
(DefaultMeta)
title { "Website!" }
}
body {
h1 #some-id { "H1" }
h2 { "H2" }
h3 { "H3" }
p { "Paragraph" }
ol {
li { "Item 1" }
li { "Item 2" }
li style="color: red" { "Item 3" }
}
footer;
}
}
).to_html_string().unwrap();

Dependencies

~83KB