# How to read line to line any text in nodered dashboard

**URL:** <https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950>\
**Category:** General\
**Created:** [26 January 2024 17:25 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950 "2024-01-26T17:25:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![azxo1](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@azxo1](https://discourse.nodered.org/u/azxo1)\
**Post date:** [26 January 2024 17:25 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950/1 "2024-01-26T17:25:35Z")

</div>

Hello everyone! I have a log file that I would like to display on the dashboard, but the text is not displayed line by line, but continuously. how to solve this?

log file:  
 ![log1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e838133b62ee6aaabac4ffced4545304349f5874.png)

dashboard:  
 ![log2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/fa6ec2f69a2096f0abaf0049b327829032292e36.png)

---

<div class="post-metadata">

**Author:** ![HaroldPetersInskipp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/haroldpetersinskipp/32/42319_2.png) [@HaroldPetersInskipp](https://discourse.nodered.org/u/HaroldPetersInskipp)\
**Post date:** [26 January 2024 17:32 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950/2 "2024-01-26T17:32:31Z")

</div>

A function node beforehand with something like:

```auto
msg.payload = msg.payload.replace(/\n/g, "<br>");
return msg;

```

Should do the trick

---

<div class="post-metadata">

**Author:** ![azxo1](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@azxo1](https://discourse.nodered.org/u/azxo1)\
**Post date:** [26 January 2024 17:38 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950/3 "2024-01-26T17:38:05Z")

</div>

It's almost good, but it doesn't read the last line

---

<div class="post-metadata">

**Author:** ![azxo1](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@azxo1](https://discourse.nodered.org/u/azxo1)\
**Post date:** [26 January 2024 17:39 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950/4 "2024-01-26T17:39:57Z")

</div>

But still. 🙂 Thank you very much for your quick reply!!!

---

<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:** [26 January 2024 17:54 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950/5 "2024-01-26T17:54:29Z")

</div>

You can add the html tag `<pre>{{msg.payload}}</pre>` in the ui-text node value format field, this will tell the browser that the text should keep its formating, e,g new lines, tabs, etc.  
example

```auto
[{"id":"955aca2f9ed86903","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":400,"y":3920,"wires":[["2cfcb43351f7c9be"]]},{"id":"2cfcb43351f7c9be","type":"template","z":"b779de97.b1b46","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"1\n2\n3\n4\n5","output":"str","x":560,"y":3920,"wires":[["7dc87205205edf64"]]},{"id":"7dc87205205edf64","type":"ui_text","z":"b779de97.b1b46","group":"4f791fdc1745d3d9","order":2,"width":0,"height":0,"name":"","label":"text","format":"<pre>{{msg.payload}}</pre>","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":690,"y":3920,"wires":[]},{"id":"4f791fdc1745d3d9","type":"ui_group","name":"micro","tab":"c954274bbed7292e","order":1,"disp":false,"width":"18","collapse":false,"className":""},{"id":"c954274bbed7292e","type":"ui_tab","name":"Solar","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![azxo1](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@azxo1](https://discourse.nodered.org/u/azxo1)\
**Post date:** [26 January 2024 20:04 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950/6 "2024-01-26T20:04:27Z")

</div>

Let me add a little:  
template node:

```auto
<style>

.nr-dashboard-cardpanel {
    text-align: left;
    box-sizing: border-box;
}
body.nr-dashboard-theme md-content {
    background: #000000;
    height: 100%;
    color: #878787;
}

.nr-dashboard-theme ui-card-panel {
    background-color: #e1484800;
    border: 5px solid #10e714;
}

body.nr-dashboard-theme md-content md-card {
    background-color: #ffffff00;
    color: #5eff1bfa;
}

.nr-dashboard-theme ui-card-panel p.nr-dashboard-cardtitle {
    color: #5eff1bfa;
}

</style>

```

And add it to the current group

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [26 January 2024 21:13 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950/7 "2024-01-26T21:13:37Z")

</div>

> [@HaroldPetersInskipp](#):
>
> ```auto
> msg.payload = msg.payload.replace(/\n/g, "<br>");
> return msg;
> 
> ```
> 
> Should do the trick

Using `<pre>` is better. No need to amend the text.

---

<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:** [10 February 2024 09:24 UTC](https://discourse.nodered.org/t/how-to-read-line-to-line-any-text-in-nodered-dashboard/84950/9 "2024-02-10T09:24:35Z")

</div>

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