# Dashboard-2 Markdown node message payload multiple lines

**URL:** <https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [23 January 2024 19:06 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843 "2024-01-23T19:06:30Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidz](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@davidz](https://discourse.nodered.org/u/davidz)\
**Post date:** [23 January 2024 19:06 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/1 "2024-01-23T19:06:30Z")

</div>

After playing more with Dashboard 2, we loved it. The new markdown node in Dashboard 2 seems to have lots of potential.

A maybe very simple question:  
How to create multiple lines from msg.payload that is sent to the Markdown node? This can avoid using multiple Markdown nodes and send multiple information with just one function node and markdown node.  
We tried the following:

```auto
msg.payload='MAC address:'+macAddress+'\r';
msg.payload+='LAN IP:'+Lan +'\r';

```

But it does not work. The Markdown node still put "MAC address" and "LAN IP" in the same line.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [23 January 2024 19:28 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/2 "2024-01-23T19:28:42Z")

</div>

Have you tried a single backslash;

`msg.payload='MAC address:'+macAddress+'\'`

---

<div class="post-metadata">

**Author:** ![davidz](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@davidz](https://discourse.nodered.org/u/davidz)\
**Post date:** [23 January 2024 19:33 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/3 "2024-01-23T19:33:03Z")

</div>

Tried it. Node-RED function does not allow single backslash.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [23 January 2024 19:35 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/4 "2024-01-23T19:35:06Z")

</div>

With

```js
const msg = `
some
text
multi
lines
`;

```

---

<div class="post-metadata">

**Author:** ![davidz](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@davidz](https://discourse.nodered.org/u/davidz)\
**Post date:** [23 January 2024 19:40 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/5 "2024-01-23T19:40:47Z")

</div>

No it is still single line.

Dashboard 2 version 0.11.6.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [23 January 2024 19:41 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/6 "2024-01-23T19:41:22Z")

</div>

Ok force with `\n`

---

<div class="post-metadata">

**Author:** ![davidz](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@davidz](https://discourse.nodered.org/u/davidz)\
**Post date:** [23 January 2024 19:43 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/7 "2024-01-23T19:43:08Z")

</div>

'\r', '\n' ... not working. Already tested.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [23 January 2024 19:45 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/8 "2024-01-23T19:45:04Z")

</div>

Maybe with `<br />` then 🤔

---

<div class="post-metadata">

**Author:** ![davidz](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@davidz](https://discourse.nodered.org/u/davidz)\
**Post date:** [23 January 2024 19:47 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/9 "2024-01-23T19:47:14Z")

</div>

Nope tried it already 😂

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [23 January 2024 19:48 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/10 "2024-01-23T19:48:46Z")

</div>

I have tried out all my ideas 😅 😂

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 January 2024 20:01 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/11 "2024-01-23T20:01:40Z")

</div>

Some Markdown parsers require either 2 spaces at the end of the line or 2 new lines.

E.g

```auto
msg.payload = `
There are 2 spaces at end of this line.  
I should be on a new line.

So should i
`
return msg

```

---

<div class="post-metadata">

**Author:** ![davidz](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@davidz](https://discourse.nodered.org/u/davidz)\
**Post date:** [23 January 2024 21:51 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/12 "2024-01-23T21:51:30Z")

</div>

Umm, just tested, it is still single line.

 ![Screenshot 2024-01-23 135104](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/889dda6cabc202239968f6f9765e1eea739e10ff.jpeg)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 January 2024 21:58 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/13 "2024-01-23T21:58:58Z")

</div>

Can you share a small demo flow

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [23 January 2024 22:06 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/14 "2024-01-23T22:06:15Z")

</div>

> [@Steve-Mcl](#):
>
> small demo flow

```auto
[{"id":"d031d854b5f70791","type":"inject","z":"be4568a984cb4685","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":360,"wires":[["c53091a9cb86c1be"]]},{"id":"c53091a9cb86c1be","type":"function","z":"be4568a984cb4685","name":"function 5","func":"msg.payload = `\nThere are 2 spaces at end of this line. \nI should be on a new line. \n\nSo should i\n`\nreturn msg","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":360,"wires":[["52c7565d26968030"]]},{"id":"52c7565d26968030","type":"ui-markdown","z":"be4568a984cb4685","group":"48fc19d1161f11e6","name":"","order":0,"width":"11","height":"9","content":"{{ msg.payload }}","className":"","x":630,"y":360,"wires":[[]]},{"id":"48fc19d1161f11e6","type":"ui-group","name":"Test","page":"19eb6d108e9275e2","width":"19","height":"12","order":-1,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"19eb6d108e9275e2","type":"ui-page","name":"Examples","ui":"ae3d4aeb3f977a90","path":"/examples","icon":"","layout":"grid","theme":"a965ccfef139317a","order":-1,"className":"","visible":"true","disabled":"false"},{"id":"ae3d4aeb3f977a90","type":"ui-base","name":"Dashboard","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"]},{"id":"a965ccfef139317a","type":"ui-theme","name":"Default","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"}}]

```

![line](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/4401dc8c7656304f7955ada8b7bb53822a9da4da.jpeg)

v0.11.6

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [23 January 2024 23:13 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/15 "2024-01-23T23:13:51Z")

</div>

I suspect this has something to do with how the binding is hooked up/sanitised.

I suspect it is a bug but may be by design or simply not supported - @joepavitt will need to comment when he is back on line.

As a potential hold over, the OP can still render a page using object notation.

e.g...

```auto
### Details:
* hostname: {{msg.payload.name}}
* MAC address: {{msg.payload.mac}}
* LAN IP: {{msg.payload.ip}}

```

Sending `payload: { mac: 'xx:xx:xx:xx:xx', ip: 'a.b.c.d', name: 'blahblah' }`

![chrome_RHL5It6TfD](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/1/61aa65a6e8a757a66f0c0caf2aac35284bb563a1.gif)

---

<div class="post-metadata">

**Author:** ![davidz](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@davidz](https://discourse.nodered.org/u/davidz)\
**Post date:** [24 January 2024 00:02 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/16 "2024-01-24T00:02:23Z")

</div>

@Steve-Mcl Yes this object notation works, which is even better.

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [24 January 2024 07:17 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/17 "2024-01-24T07:17:10Z")

</div>

Glad this works, odd that the `</br>` does not though, I would have expected that to, but will need to dig into more as to why it doesn't.

Have opened [Markdown - New line options do not work · Issue #512 · FlowFuse/node-red-dashboard · GitHub](https://github.com/FlowFuse/node-red-dashboard/issues/512) to keep track of it

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 February 2024 07:18 UTC](https://discourse.nodered.org/t/dashboard-2-markdown-node-message-payload-multiple-lines/84843/18 "2024-02-07T07:18:00Z")

</div>

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