Skip to content

Interpolation

Interpolation enables dynamic content generation within workflow nodes by embedding JavaScript expressions in text. Those expressions can take the following shapes:

  1. Inline
  2. Code Blocks

Inline Evaluation

Inline interpolation uses <% %> delimiters to execute JavaScript expressions and output results in-place within text. For example:

md
# Found <% issue_count %> issues

NOTE

The example above assumes a issue_count variable was previously declared.

Escaping

Use \<% %> to display literal interpolation syntax without execution (shows as <% %>).

Comments

SyntaxDescription
<% value // comment %>Line comments - %> closes the interpolation block.
<% /* comment with %> */ value %>Block comments allow including %> in comments.

Tagged Code Blocks

Markdown-style code blocks with the exec tag are evaluated by the JavaScript engine. For example:

md
```exec
const issue_count = 5;
println("# Found " + issue_count + " issues");
```

Output Functions

FunctionDescription
print(...values)Outputs values without newline.
println(...values)Outputs values with newline.

NOTE

Only explicitly printed content appears in final output. The exec code block itself is not visible.

TIP

As all fields share the same context, pre-compute complex values in exec blocks without print statements, then reference variables in simple <% variable %> interpolations for improved readability.

Javascript Engine

Interpolation uses Caido's JavaScript runtime environment. See JavaScript in Workflows for understanding JavaScript concepts in workflows and refer to the Runtime documentation for detailed technical specifications.

Accessing previous nodes

All previous node outputs within a workflow are accessible using their alias, allowing interpolation to use values from earlier nodes in the workflow chain.

Shared context

All Interpolable fields within a workflow node share the same execution context which entails the following:

  • Execution Order: Interpolations execute sequentially in the order they appear within the node, allowing building upon previous computations.
  • Shared Context: All interpolations in a single node share the same JavaScript environment, meaning variables, functions, and state are accessible across all expressions within that node.