diff --git a/README.md b/README.md index 7a08be6..6d22dd2 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,14 @@ let greeting = h1( assert_eq!(greeting.to_string(), r#"

Hello world!

"#); ``` +Because those are simple rust functions, it is easy to leverage rust features like conditions, loops and iterators: + +```rust +let list = ul([], (1..=3).map(|n| li([], [n.to_string().into()]))); +assert_eq!(list.to_string(), ""); +``` + + ## MSRV The minimum supported rust version is currently `1.60`. diff --git a/src/lib.rs b/src/lib.rs index acc7603..00238d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,6 +24,14 @@ //! assert_eq!(greeting.to_string(), r#"

Hello world!

"#); //! ``` //! +//! Because those are simple rust functions, it is easy to leverage rust features like conditions, loops and iterators: +//! +//! ``` +//! # use fun_html::{elt::{li,ul}}; +//! let list = ul([], (1..=3).map(|n| li([], [n.to_string().into()]))); +//! assert_eq!(list.to_string(), ""); +//! ``` +//! //! ## Escape hatches //! //! If necessary, it is possible to define custom elements and attributes with respectively [`Element::new`] and [`Attribute::new`].