Simple templating language for HTML. Define components and rewrite parts of HTML with them.
HTML 82.4%
Rust 16.0%
Other 1.6%
7 1 0

Clone this repository

https://tangled.org/j0.lol/makup
git@tangled.org:j0.lol/makup

For self-hosted knots, clone URLs may differ based on your setup.

README.md

makup#

Simple templating language for HTML. Define components and rewrite parts of HTML with them.

Example#

Input:

<body>
    <h1>Hello!</h1>

    <p>Lorem lorem</p>

    <#hello>World</#hello>
</body>

Parser:

fn hello(input: &str, attrs: HashMap<&str, &str>) -> String {
    String::from(format!("<span>Hello {input}</span>"))
}

let mut writer = Rewriter::default();
writer.add_component("hello", hello);
let output = writer.rewrite(MARKUP)?;

Output:

<body>
    <h1>Hello!</h1>

    <p>Lorem lorem</p>

    <span>Hello World</span>
</body>