Crates.io | hypertext-macros |
lib.rs | hypertext-macros |
version | 0.5.1 |
source | src |
created_at | 2024-01-12 03:34:54.262567 |
updated_at | 2024-06-18 11:47:54.44168 |
description | A blazing fast type-checked HTML macro crate. |
homepage | https://github.com/vidhanio/hypertext |
repository | https://github.com/vidhanio/hypertext |
max_upload_size | |
id | 1097273 |
size | 65,064 |
hypertext
A blazing fast type-checked HTML macro crate.
#![no_std]
supporthypertext
Make a pull request to list your project here!
use hypertext::{html_elements, GlobalAttributes, RenderIterator, Renderable};
let shopping_list = ["milk", "eggs", "bread"];
let shopping_list_maud = hypertext::maud! {
div {
h1 { "Shopping List" }
ul {
@for (&item, i) in shopping_list.iter().zip(1..) {
li.item {
input #{ "item-" (i) } type="checkbox";
label for={ "item-" (i) } { (item) }
}
}
}
}
}
.render();
// or, alternatively:
let shopping_list_rsx = hypertext::rsx! {
<div>
<h1>Shopping List</h1>
<ul>
{ shopping_list.iter().zip(1..).map(|(&item, i)| hypertext::rsx_move! {
<li class="item">
<input id=format!("item-{i}") type="checkbox">
<label for=format!("item-{i}")>{ item }</label>
</li>
}).render_all() }
</ul>
</div>
}
.render();