How to share code or flow json


#1

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 paste in your code or flow json, select it all, then click the 'Preformatted Text' button in the toolbar:

image

This will automatically insert 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.


Temperature date from xiaomi
How set the output variable "{{msg.payload}}" in JS?!
Embed Node-RED into mean express on the same port in an iframe
Dashboard not appearing
EXAMPLE (template) - displaying a two dimensional table
Test of a sensor
Speeding up picture taking
Switch node and Object message
Can node-red node/flow run in parallel?
How to make an IoT protocol (parsing, answering)?
Create json object in flow
MySQL NODE-RED table
Passing msg.payload to template node
Write Slide Value
Access data in template node using mustache
Static Text in the Dashboard Titlebar?
Representing locations in worldmap
Accessing global variables from a custom node
Cryptomining Malware Infecting Node-RED servers
NLC node fails to connect NLC instance on IBM Cloud
RED.httpAdmin.get not refreshing JSON
Live gpio timer duration to lcd
HomeKit Garage Door Opener (Raspberry Pi)
Return value from OPC.IIoT.Result-Filter
Function not working after update
Trouble with UTC and lighting automation
Can't get the blog post
Node red sms app
Blog site using Mongo db
Import querySelector function
Node-red mongodb update record
Read and write a json file - solved
node-RED can not be opened anymore
PCF9685 Dimmen slow
Visibility images via ui_template
URL variables http get request
Return triggers Maximum call stack size
Newbie here using Hassio
Dropbox folder sync
How to convert to a function
How to convert to a function
Access msg.payload in script tag
Virtual keyboard in any text fields
How to make a counter incoming\outgoing on two sensors?
Passing an input to exec node which execute a python script
How to do a simple sum of two msgs which are arrays
ReferenceError: SunCalc is not defined
Arduino serial data and alarms
Jsonata: return value from context array
"Rich File Manager" in node-red
Question for evaluation rfxcom-out
I have some questions relating database
Error: Cannot find module 'i2c-bus'
How can i append to PDF file in Node-Red?
Function to store data from csv to table?
Special character encoding /Utf8 problem
Trying to retrieve info from a website problems, I'm just a rookie
How To Make Logging Data Values in Chart
Returnvalue in function-node from async action-node
Nodes suggestion for timed rolling average and desynchronised sum
How can I get array components values
Switch Node with time
Create an admin configuration API HTTPS endpoint
Problem using ng-change directive with Dashboard Template
Read from mysql db
Help with a function node
Notification based on input
Dashboard - How to add OK or Cancel button
Simple sum gives wrong answer ... I am using get and set
Dashboard - How to add OK or Cancel button
SNMP Set - NoSuchName
Aosong AM2315 temp/rh
"TypeError: msg.payload.split is not a function"
Return msg from ui_template node
Dashboard using template node
Node-Red Dashboard Graph
Pausing timer in mytimeout
If ( var1 = true and var2 = true ) then / else
Cumulative running time
Need help on how to change UI text icon color with input value from Serial Node
Code question from a dopey newbe[solved]
Datatype error for fieldbus node
Compare inside temp to outside
From array message, get specific columns
Please help me..pilcd doesn't work(raspberry pi+16x2lcd)
Node-red influxdb invalid boolean
How to access payload in mustache template under script tag
Three backticks
Newbies forum/section?
Firebase and nodered help!
#3

Also, (especially larger flows) can now be saved as a txt or json file and uploaded directly to the post.

Paul


Node-red Exec node python code with Mac
Local weather group for Dashboard
Automatic restart Node Red on Linux
Plot a time series using highcharts
Link Node don t find new links
Passing (msg.payload) in exec node to a python script function