htmlificator 0.2.1

Generate HTML source code through rust functions!
Documentation
  • Coverage
  • 0%
    0 out of 7 items documented0 out of 1 items with examples
  • Size
  • Source code size: 10.33 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 377.44 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • IsotoxalDev/htmlificator
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • IsotoxalDev

Htmlificator

This crate provides an element struct which can be displayed as HTML.

License

This crate is licensed under the MIT license

Credit

This crate has used a snippet from the TextWrap crate for indentation of the child elements.

Usage

[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)
}