# Elastic ML Alert Mustache Syntax (Break Line)

**URL:** <https://discuss.elastic.co/t/elastic-ml-alert-mustache-syntax-break-line/327024>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning, elastic-stack-alerting\
**Created:** [March 6, 2023, 4:46am UTC](https://discuss.elastic.co/t/elastic-ml-alert-mustache-syntax-break-line/327024 "2023-03-06T04:46:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)\
**Post date:** [March 6, 2023, 4:46am UTC](https://discuss.elastic.co/t/elastic-ml-alert-mustache-syntax-break-line/327024/1 "2023-03-06T04:46:15Z")

</div>

Hi,

I would like to adjust my email alert to break to a new line.

 ![Email Alert](https://us1.discourse-cdn.com/elastic/original/3X/d/6/d69cc912e334d5ed0fdff30ec91ea8935daa954e.png)

From above image, the upper context for (Environment Affected) is working as I used **{{{foo}}}** to break it.

However, it does not work for the (Detector Attribute) context.

It became weirdly manner the message.

How do I fix this? How do I break it to a new line the alert message?

Below is my mustache syntax code for the email message:

```auto
- Environment Affected:
{{#context.topInfluencers.length}}
    {{#context.topInfluencers}}
     {{{foo}}} 
     {{influencer_field_name}} = {{influencer_field_value}} 
     {{/context.topInfluencers}}
{{/context.topInfluencers.length}}

- Detector Attribute:
{{#context.topRecords.length}}
   {{#context.topRecords}}
         {{{foo}}} 
         {{function}}({{field_name}}) {{by_field_value}}{{over_field_value}}
         {{partition_field_value}}, 
         Typical Value of Detector: [{{typical}}], Actual Value of Detector
         (Anomaly): [{{actual}}] 
     {{/context.topRecords}}
{{/context.topRecords.length}}

- Anomaly score: {{context.score}}

```

Thank you.

---

<div class="post-metadata">

**Author:** ![darnautov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/darnautov/32/70608_2.png) [@darnautov](https://discuss.elastic.co/u/darnautov)\
**Post date:** [March 6, 2023, 9:16am UTC](https://discuss.elastic.co/t/elastic-ml-alert-mustache-syntax-break-line/327024/2 "2023-03-06T09:16:18Z")

</div>

Hi @aisyaharifin,

The reason for broken formatting is the escaping for special characters contained in the `field_name` variable and the others. You can disable it by wrapping a variable with an extra set of curly braces, i.e. `{{{field_name}}}` instead of `{{field_name}}`.

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:** [April 3, 2023, 9:16am UTC](https://discuss.elastic.co/t/elastic-ml-alert-mustache-syntax-break-line/327024/3 "2023-04-03T09:16:37Z")

</div>

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