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>