#html-template #macro #html #template #vy

macro vy-macros

A convenient and type-safe HTML templating library

3 unstable releases

new 0.2.0 Apr 26, 2025
0.1.1 Oct 17, 2024
0.1.0 Oct 15, 2024

#107 in #template-engine

Download history 2/week @ 2025-02-05 2/week @ 2025-03-12 118/week @ 2025-04-23

118 downloads per month
Used in vy

MIT license

69KB
1.5K SLoC

vy

crates.io docs.rs build license: MIT

Fast and minimal HTML templating macros in Rust.

Usage

vy::render! {
  <div>
    <h1>"This is awesome!"</h1>
    <img src="/sunrise.png" />
  </div>
}

Syntax

The parsing is done via tiny-rsx, with a very simple and minimal JSX-like syntax.

  • Rust expressions are interpreted with braces, e.g. <span>{1 + 2}</span>.
  • Text should always be quoted, e.g. <p>"My text"</p>.
  • Void tags should end with a forward slash, e.g. <br />.

Escaping

Escaping is opt-out, meaning values are escaped automatically unless you use PreEscaped(..).

Dependencies

~320–780KB
~17K SLoC