# How to formatting output in "Notification node"

**URL:** <https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309>\
**Category:** General\
**Created:** [18 January 2021 07:31 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309 "2021-01-18T07:31:17Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariulin](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mariulin](https://discourse.nodered.org/u/mariulin)\
**Post date:** [18 January 2021 07:31 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/1 "2021-01-18T07:31:17Z")

</div>

Hi folks.

I'm using a "Button node" to execute a Linux system command then I pass the payload to a "Exec node" then to a "Notification node". The problem is that the output is on one line like this:

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/3/2397da36125aa9988dd4152c21d4d970c5b624a8.png).  
In "debug node" I see the output in the correct way

Is possible to have the output in the correct way also in "notification node"?

Thank you

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [18 January 2021 08:45 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/2 "2021-01-18T08:45:03Z")

</div>

try the pre html tag  
[https://www.w3schools.com/tags/tag\_pre.asp](https://www.w3schools.com/tags/tag_pre.asp)

---

<div class="post-metadata">

**Author:** ![mariulin](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mariulin](https://discourse.nodered.org/u/mariulin)\
**Post date:** [18 January 2021 15:37 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/3 "2021-01-18T15:37:59Z")

</div>

Where can I put this code? In what node?  
Thank you.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [18 January 2021 15:50 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/4 "2021-01-18T15:50:23Z")

</div>

Did you read the link , the first thing it shows is the pre tag around the text. so try putting it either side of the text, in the notification node.

```auto
<pre>the text you wish to keep formating of</pre>

```

The notification node allow html and css as far as i am aware.  
in a template node just before the notification node, `<pre>{{payload}}</pre>` were payload would be the property that holds the text.

---

<div class="post-metadata">

**Author:** ![mariulin](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mariulin](https://discourse.nodered.org/u/mariulin)\
**Post date:** [18 January 2021 15:53 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/5 "2021-01-18T15:53:56Z")

</div>

Ok, but the text come from a command over Linux. My problem is to format that text...  
And the example you posted, show how to do it in pure HTML/CSS not in Nodered.

Can you tell me what can I do or not please? It seems it's a secret or a mystery...

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [18 January 2021 16:22 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/6 "2021-01-18T16:22:08Z")

</div>

No secret you just need to read the info provided. [The Core Nodes : Node-RED](https://nodered.org/docs/user-guide/nodes#template)

---

<div class="post-metadata">

**Author:** ![mariulin](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mariulin](https://discourse.nodered.org/u/mariulin)\
**Post date:** [18 January 2021 16:29 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/7 "2021-01-18T16:29:23Z")

</div>

This evening at home I will read all and try.  
If I can't obtain my result can I ask you an example tomorrow?

Thank you so much...

---

<div class="post-metadata">

**Author:** ![mariulin](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mariulin](https://discourse.nodered.org/u/mariulin)\
**Post date:** [18 January 2021 16:34 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/8 "2021-01-18T16:34:31Z")

</div>

> [@E1cid](#):
>
> The notification node allow html and css as far as i am aware.  
> in a template node just before the notification node, `<pre>{{payload}}</pre>` were payload would be the property that holds the text.

I've not read this part of your message. I'm on work and also not in my office. Sorry...

---

<div class="post-metadata">

**Author:** ![mariulin](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mariulin](https://discourse.nodered.org/u/mariulin)\
**Post date:** [18 January 2021 21:40 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/9 "2021-01-18T21:40:12Z")

</div>

I've trying to put "Template node" with "\<pre\>{{payload}}\</pre\>" code inside, between "stdout exit of Exec node" and "input of Notification node", but the result is that there is **\<pre\>** on the beginning of output and **\</pre\>** to the end.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dcaa1f6ef0380175d7a2018e484e01fec4df48f1.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [18 January 2021 21:59 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/10 "2021-01-18T21:59:42Z")

</div>

Try checking  
Accept raw HTML/JavaScript input in msg.payload to format popup  
In the template node.

---

<div class="post-metadata">

**Author:** ![mariulin](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mariulin](https://discourse.nodered.org/u/mariulin)\
**Post date:** [19 January 2021 07:30 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/11 "2021-01-19T07:30:48Z")

</div>

Flagging **"_Accept raw HTML/JavaScript input_"** in Notification Node has resolved. Now output is leggible.  
Thank you very much for all

---

<div class="post-metadata">

**Author:** ![mariulin](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mariulin](https://discourse.nodered.org/u/mariulin)\
**Post date:** [25 January 2021 08:56 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/12 "2021-01-25T08:56:02Z")

</div>

There is another little problem. I've noticed that the text between \<pre\> and \</pre\> is outputted in a "template node" as "normal text" and has no more CSS applied. Is possible to set CSS for a specific block?  
Thank you

---

<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:** [8 February 2021 08:56 UTC](https://discourse.nodered.org/t/how-to-formatting-output-in-notification-node/39309/13 "2021-02-08T08:56:45Z")

</div>

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