Rendering Text
Evaluate Kaya templates to produce plain text.
The native render function evaluates Kaya's Liquid-style templates, resolving
variables inside double curly braces ({{ ... }}) and returning a plain text
string. See Templating for the
supported syntax and strict variable rules.
Signature
render(
template: string, // Required: Liquid template string
vars?: Record<string, unknown> // Optional: Variables to pass dynamically
) -> stringExample
let result = render(
template: "Hello, {{user.name}}! Your score is {{user.score}}.",
vars: { user: { name: "Alice", score: 95 } }
)
// result = "Hello, Alice! Your score is 95."If vars is omitted, render automatically falls back to resolving variables from the local Kaya stack context.