Introduction
zamn is a static way to write HTML. A tag is its name, classes and ids are .class and #id, and an element's children go in a { } block. There are no closing tags, and nothing to keep in sync.
article.post#intro {
h2.title Hello
p {
| Written in
|
a(href="https://github.com/zeokku/zamn") zamn
| .
}
}<article class="post" id="intro">
<h2 class="title">Hello</h2>
<p>
Written in
<a href="https://github.com/zeokku/zamn">zamn</a>
.
</p>
</article>The HTML is shown formatted, here and throughout the docs; the compiler writes it on one line.
Static, on purpose
A zamn template is markup. Logic, loops and composition belong to your framework: li(v-for="item in items"), p(v-if="user"), components. Attribute values are strings, as in HTML, and expressions go in bindings (:title="t", @click="go") or = expr, which writes {{ expr }}. Text is escaped, so p a < b shows a < b.
Since there is nothing to run, a template compiles to the same HTML every time, in one pass, with a source map. Tooling can read it without executing anything: the Vue language tools, ESLint and Prettier all work on zamn templates.
Why another syntax
zamn was originally inspired as a modern pug replacement: compact templates, but without indentation quirks, with a clearer syntax, modern maintained code and performance. Its syntax for tags, classes, ids and attributes comes from pug's.
- Less to read. No
</div>at the bottom of the screen to match up with the top: a block ends with a}. - Braces, not indentation. Pug templates are commonly criticized for indentation-based nesting, which gets hard to read and maintain. That's why zamn nests with
{ }blocks instead, just like JavaScript or SCSS. Indentation is for the eye, and zamn warns about a line indented like a child when it isn't one. - Less to write. For people, and for coding agents: the same page takes fewer tokens in zamn than in HTML. See Writing zamn with AI agents.
- Nothing hidden. What you write is what you get: there's no runtime and no logic in the template.
Where to go next
- Getting started: install it, compile a file.
- Syntax: the whole language, one page per topic.
- Ecosystem: Vite, TypeScript, ESLint, Prettier and VS Code for Vue projects.
- Playground: try it in the browser.
