How to share code or flow json

To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly.

The easiest way to do that is to click the 'Preformatted Text' button in the toolbar:

image

Then paste in your code or flow json.

You should end up with three back-tick characters - ``` - on their own line before and after the code.

On standard US English keyboards, this is on the same key as the ~ character.

Using the backticks will ensure the forum does not reformat the code.

[{"id":"bbef23cc.4e7f18","type":"inject"}]

You can see the quotes remain untouched.

For code from a Function node, first without the backticks:

msg.payload = "Hello There";
return msg;

And again, with the backticks:

msg.payload = "Hello There";
return msg;

The added syntax highlighting also makes it much easier to read.

This should be used for any code samples, such as flow JSON, JavaScript, html or XML samples.

21 Likes