Crates.io | htmlificator |
lib.rs | htmlificator |
version | 0.2.1 |
source | src |
created_at | 2022-11-05 18:37:03.540643 |
updated_at | 2022-11-07 06:05:41.67244 |
description | Generate HTML source code through rust functions! |
homepage | |
repository | https://github.com/IsotoxalDev/htmlificator |
max_upload_size | |
id | 706003 |
size | 10,333 |
This crate provides an element struct which can be displayed as HTML.
This crate is licensed under the MIT license
This crate has used a snippet from the TextWrap crate for indentation of the child elements.
[dependencies]
htmlificator = "0.2.1"
use htmlificator::Element;
fn main() {
let mut el = Element::new("Div", false);
el.add_class("TestClass");
let mut h1 = Element::new("H1", false);
h1.add_text("This is a heading!!");
el.add_element(h1);
el.add_comment("A Comment");
let mut btn = Element::new("Button", true);
btn.add_attribute("text", "This is a Button");
el.add_element(btn);
println!("{}", el)
}