6 releases

0.2.0 Apr 6, 2023
0.1.4 Apr 2, 2023
0.1.1 Dec 11, 2021
0.1.0 Nov 26, 2021

#1312 in Rust patterns


Used in 2 crates

MIT license

42KB
876 lines

laby

Crate Docs Maintainer License Issues Contributors

laby is a small macro library for writing HTML templates in Rust. Documentation

let n = html!(
  head!(
    title!("laby"),
  ),
  body!(
    p!("Hello, world!"),
  ),
);

let s = render!(DocType::HTML5, n);
<!DOCTYPE html><html><head><title>laby</title></head><body><p>Hello, world!</p></body></html>

lib.rs:

Contains code required by laby at both compile time and runtime.

This crate mainly provides the Render trait that forms the basis of all HTML rendering operations, the escape function that escapes strings for HTML inclusion, and the Buffer type that provides the rendering output buffer.

This crate is re-exported by crate laby. If you are using laby, you should not depend on this crate directly.

Dependencies

~765KB
~13K SLoC