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 https://tangled.org/did:plc:by6abidhbnj6siox5if2wzq6/makup
git@knot.tangled.wizardry.systems:j0.lol/makup git@knot.tangled.wizardry.systems:did:plc:by6abidhbnj6siox5if2wzq6/makup

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

Download tar.gz
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>