Syntax

Kida template language syntax for HTML templates, inheritance, filters, and control flow

2 min read 388 words

Kida's template syntax for expressions, control flow, inheritance, filters, and composition.

Quick Reference

Element Syntax Example
Output {{ expr }} {{ user.name }}
Tags {% tag %} {% if %}, {% for %}
Block end {% end %} Unified ending
Comments {# text #} {# TODO #}
Filters | filter {{ name \| upper }}
Pipeline |> filter {{ x \|> a \|> b }}
Safe pipeline ?|> filter {{ x ?\|> a ?\|> b }}
Optional filter ?| filter {{ x ?\| upper }}
Nullish assign ??= {% let x ??= "default" %}

Syntax Guide

Key Features

  • Unified{% end %} — Clean, consistent block endings
  • Pattern matching{% match status %}{% case "active" %}...{% end %}
  • Pipeline operator{{ title |> escape |> upper |> truncate(50) }}
  • Safe pipeline{{ user?.name ?|> upper ?? "Anonymous" }}— None-propagating
  • Nullish assignment{% let title ??= "Untitled" %}— set only if undefined/None
  • Built-in caching{% cache "sidebar" %}...{% end %}