-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathREADME.md.erb
62 lines (42 loc) · 2.01 KB
/
README.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<div align="center">
# markup.rs
A blazing fast, type-safe template engine for Rust.
[![Build](https://img.shields.io/github/actions/workflow/status/utkarshkukreti/markup.rs/build.yml?style=for-the-badge)](https://github.com/utkarshkukreti/markup.rs/actions/workflows/build.yml)
[![Version](https://img.shields.io/crates/v/markup?style=for-the-badge)](https://crates.io/crates/markup)
[![Documentation](https://img.shields.io/docsrs/markup?style=for-the-badge)](https://docs.rs/markup)
[![Downloads](https://img.shields.io/crates/d/markup?style=for-the-badge)](https://crates.io/crates/markup)
[![License](https://img.shields.io/crates/l/markup?style=for-the-badge)](https://crates.io/crates/markup)
</div>
`markup.rs` is a template engine for Rust powered by procedural macros which
parses the template at compile time and generates optimal Rust code to render
the template at run time. The templates may embed Rust code which is type
checked by the Rust compiler enabling full type-safety.
## Features
* Fully type-safe with inline highlighted errors when using editor extensions like [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer).
* Less error-prone and terse syntax inspired by [Haml](https://haml.info/), [Slim](http://slim-lang.com/), and [Pug](https://pugjs.org).
* Zero unsafe code.
* Zero runtime dependencies.
* ⚡ Blazing fast. The fastest in [this](https://github.com/djc/template-benchmarks-rs) benchmark among the ones which do not use unsafe code, the second fastest overall.
## Install
```toml
[dependencies]
markup = "0.15.0"
```
## Framework Integration
We have integration examples for the following web frameworks:
1. [Axum](examples/axum/src/main.rs)
2. [Rocket](examples/rocket/src/main.rs)
## Quick Example
```rust
<%= File.read("./markup/examples/quick.rs").strip %>
```
### Output
```html
<%= `cargo run --example quick`.strip %>
```
### Output (manually prettified)
```html
<%= `cargo run --example quick | prettier --parser html`.strip %>
```
## Syntax Reference (WIP)
<%= `rake`.strip %>