Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vidhanio/hypertext
A blazing fast type-checked HTML macro crate.
https://github.com/vidhanio/hypertext
html macro rust
Last synced: 12 days ago
JSON representation
A blazing fast type-checked HTML macro crate.
- Host: GitHub
- URL: https://github.com/vidhanio/hypertext
- Owner: vidhanio
- License: mit
- Created: 2024-01-12T03:34:30.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-10-08T06:39:53.000Z (about 1 month ago)
- Last Synced: 2024-10-11T12:08:16.227Z (about 1 month ago)
- Topics: html, macro, rust
- Language: Rust
- Homepage: https://docs.rs/hypertext
- Size: 181 KB
- Stars: 72
- Watchers: 3
- Forks: 8
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# `hypertext`
A blazing fast type-checked HTML macro crate.
## Features
- Type checking for element names/attributes
- Completely extensible for use with non-standard elements/attributes
- `#![no_std]` support
- Automatic escaping
- Lazy rendering by default to avoid multiple allocations
- Results in outstanding performance in cases of nested documents, which other libraries may falter in## Projects Using `hypertext`
- [vidhan.io](https://github.com/vidhanio/site), my website
Make a pull request to list your project here!
## Example
```rust
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! {
Shopping List
{ shopping_list.iter().zip(1..).map(|(&item, i)| hypertext::rsx_move! {
{ item }
}).render_all() }
}
.render();
```