13 releases (2 stable)

2.0.0 Dec 7, 2024
1.0.0 Nov 5, 2024
0.12.0 Oct 5, 2024
0.8.0 May 7, 2024
0.6.0 Mar 17, 2024

#210 in Template engine

Download history 172/week @ 2024-09-11 23/week @ 2024-09-18 23/week @ 2024-09-25 126/week @ 2024-10-02 20/week @ 2024-10-09 1/week @ 2024-10-16 60/week @ 2024-10-30 75/week @ 2024-11-06 3/week @ 2024-11-13 3/week @ 2024-11-20 133/week @ 2024-12-04 23/week @ 2024-12-11 4/week @ 2024-12-18

160 downloads per month
Used in claro

MIT license

20KB
434 lines

Toph

Toph is an HTML generation library. It's implemented as a declarative macro, html!, that transforms your markup into imperative code to build up an HTML tree. This tree can then be converted to a string.

let _ = toph::html! {
    doctype["html"]
    html {
        title {
            (toph::text("hello world"))
        }
    }
    body {
        p[class = "intro"] {
            (toph::text("This is an example of the "))
            a[href = "https://git.sr.ht/~eze-works/toph/"] {
                (toph::text(" template language"))
            }
        }
    }
};

lib.rs:

A rust macro for writing HTML templates

The entrypoint to this crate is the html! macro.

No runtime deps