# Formatting markdown alert email (new line)

**URL:** <https://discuss.elastic.co/t/formatting-markdown-alert-email-new-line/332297>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [May 2, 2023, 2:22pm UTC](https://discuss.elastic.co/t/formatting-markdown-alert-email-new-line/332297 "2023-05-02T14:22:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ppic](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@ppic](https://discuss.elastic.co/u/ppic)\
**Post date:** [May 2, 2023, 2:22pm UTC](https://discuss.elastic.co/t/formatting-markdown-alert-email-new-line/332297/1 "2023-05-02T14:22:27Z")

</div>

Hi,  
In "Rules and Connectors", I created an alert generating an email.  
In this email, I want to display values of a fields, that contain NewLines  
In Discover, we can see these NewLines.  
In the email, there is no more NewLines.  
Even though we use markdown, is there a way to display the value of this field, while respecting the NewLines in this value?  
Thank you.  
(I use Kibana 7.17)

---

<div class="post-metadata">

**Author:** ![ppic](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@ppic](https://discuss.elastic.co/u/ppic)\
**Post date:** [May 5, 2023, 2:15pm UTC](https://discuss.elastic.co/t/formatting-markdown-alert-email-new-line/332297/2 "2023-05-05T14:15:46Z")

</div>

Hi,  
I found a solution because the values with new lines come from a SQL query.  
Then I modified the query like this :

- original :

```auto
select Message 'ErrMsg_Message', (...)

```

- after:

```auto
select REPLACE(Message, CHAR(13) + CHAR(10), ' ' + CHAR(13) + CHAR(10)) 'ErrMsg_Message' (...)

```

As the DB server is under Windows, the End-of-line is CHAR(13) + CHAR(10) (hexa: 0D 0A).  
It inserts two spaces before the EOL, so that markdown prints a new line.

I had also a similar problem with the date, to make it more readable. For example :  
2023-04-27T13:36:32.364Z --\> 27/04/2023 13:36:32  
with :

```auto
select FORMAT(Date,'dd/MM/yyyy HH:mm:ss '),

```

But to display the Kibana @timestamp (in the alert mail : {{context.date}}), I don't know.  
Hope it helps....

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 2, 2023, 2:16pm UTC](https://discuss.elastic.co/t/formatting-markdown-alert-email-new-line/332297/3 "2023-06-02T14:16:32Z")

</div>

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