Skip to main content

Expressions

Pictify templates come in two engines, and each has its own syntax for dynamic logic: Both engines share the same function library (the tables below) — only the call style differs. Using expression-style currency(price, 'USD') in a Handlebars HTML template (or vice versa) will fail validation.

Handlebars syntax (HTML templates)

HTML templates (engine: "html") use standard Handlebars: {{variable}} interpolation, block helpers, and positional helper calls. Templates are compile-validated on save — unclosed blocks or unknown helpers fail with HTTP 422.

Variables and escaping

{{variable}} HTML-escapes its output. Raw HTML output with {{{variable}}} additionally requires allowRawHtml: true on that variable’s definition — an XSS guard for user-supplied data.

Conditionals

There is no == operator and no custom helper registration (helpers are safelisted). For comparisons, pass a precomputed boolean in your render variables — or use the boolean helpers in a subexpression:
contains, isEmpty, isNotEmpty, isDefined, startsWith, endsWith, and the other boolean functions all compose this way.

Loops

@index, @first, @last, and @key (for objects) are available inside the block; ../ reaches the parent context. Each render carries a 5,000-iteration cap across all #each blocks — runaway loops fail loudly instead of hanging.

Calling functions from Handlebars

Every function in the library below is available as a Handlebars helper using positional arguments (no parentheses or commas):
Partials ({{> name}}) are not supported — reuse happens at the template level.

Expression syntax (canvas templates)

Canvas templates (engine: "fabric") use the expression engine: function calls, arithmetic and comparison operators, and ternaries inside {{expression}}. The examples in the rest of this page use this style.

Simple Variables

Property Access

Access nested properties with dot notation:

Arithmetic

Comparisons

Logical Operators

Ternary Operator

Built-in Functions

The function library is shared by both engines. Examples below use expression style (canvas engine); in Handlebars HTML templates call the same functions positionally — {{currency price 'USD'}} instead of {{currency(price, 'USD')}}.

String Functions

Number Functions

Formatting Functions

Array Functions

Type Checks

Utilities

Conditional Rendering

If/Else in Text

Conditional Objects

In template objects, use the _if property:
The object is only rendered if the condition evaluates to true.

Complex Conditions

Text Interpolation

Combine static text with expressions:
Multiple expressions in one string:

Testing Expressions

Test expressions before using them in templates:

Validate Syntax

Response:

Test with Data

Response:

List Available Functions

Examples

Personalized Greeting

Price Display

Date Formatting

Conditional Badge

Array Display