Interpolation
Interpolation enables dynamic content generation within workflow nodes by embedding JavaScript expressions in text. Those expressions can take the following shapes:
Inline Evaluation
Inline interpolation uses <% %> delimiters to execute JavaScript expressions and output results in-place within text. For example:
# Found <% issue_count %> issuesNOTE
The example above assumes a issue_count variable was previously declared.
Escaping
Use \<% %> to display literal interpolation syntax without execution (shows as <% %>).
Comments
| Syntax | Description |
|---|---|
<% 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:
```exec
const issue_count = 5;
println("# Found " + issue_count + " issues");
```Output Functions
| Function | Description |
|---|---|
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. Refer to the runtime documentaion 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.
