Canvas Expression Syntax NewLine & Comments

Greetings,

I need help with two specific features, would greatly appreciate any help you could hand me.

I'm setting up a canvas Workpad and I wanted to add some sort of documentation through comments in my code, so other people working on the same project can later on understand why I've taken a certain approach. I haven't seen anything documented about how to achieve that yet.

Secondly, I'm building a string variable that I'm later going to reference inside the markdown section of this text box element, and I wanted to add a line breaker/new line character inside this variable and so far I have failed short of it as well.

Thanks in advance!

Hi @GoncaloCarvalho.

You can add comments in the Canvas Expression Editor the same way it is done in JavaScript using either // <my comments> for single line comments or /* <my comments> */ for multiple lines.

Variables in Canvas also act the same way as JavaScript. So you can use a backslash (\) to terminate a line within the string. For example:

kibana
| var_set myvariable value='This\
variable\
has\
multiple\
lines'
| markdown {var myvariable}
| render

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.