Mystery Line Breaks (<br />'s) Before Tables in Trigger Emails | Community
Skip to main content

Mystery Line Breaks (<br />'s) Before Tables in Trigger Emails

  • February 11, 2022
  • 8 replies
  • 0 views

Jake20

I am trying to add an HTML table to an email that is sent by a zendesk "trigger". While designing the email, I have noticed that Zendesk (or the Liquid templating engine) is adding mystery line breaks (<br />'s) to the email, right above any table that is added, and the number of <br />'s added depends on how many elements are in the table. 

For example, if I add a small 1-row table to the body of my trigger email, like this one...

<table>
<tr><td>This is a small table</td></tr>
</table>

...then Zendesk adds 2 mystery <br />'s to the email, right before the table, like this...

If the table has a bit more content, like a 5 row table, like this...

<table>
<tr><td>This is row 1.</td></tr>
<tr><td>This is row 2.</td></tr>
  <tr><td>This is row 3.</td></tr>
  <tr><td>This is row 4.</td></tr>
  <tr><td>This is row 5.</td></tr>
</table>

...then Zendesk adds 6 mystery <br />'s to the email, right before the table, like this...

As you can imagine, this has a big negative effect on the formatting of the email. The table I'm hoping to add has ~14 cells in it, and when the email is delivered, is has a massive white space right above the table because Zendesk is adding a whopping 15 mystery line breaks to the email.

Has anyone ran into this before? Might there be a workaround to still being able to use HTML tables, but not have these line breaks added?

8 replies

Bry
  • February 23, 2022

Hey Jake! I've replied in your ticket to get some more information. For anyone else that's following this, I'll be sure to report back once I learn more.


Ola11
  • September 21, 2022

I'm experiencing this exact same issue - line breaks added before a table in a trigger email. Please could you let me know if there were any workarounds or other updates when this was looked at previously?


Hiedi
  • October 3, 2022

Hi @ola11,

Due to the nature of your issue, I created a ticket on your behalf so we can troubleshoot this issue together. Please check your email for more information. Speak soon! 


We're continuing to have the same issue. We are going to try and work around it by changing the `br` styles but it would be nice to get this resolved!


Egon
  • June 7, 2023

Hi! Same here. Added <br />-s are breaking html layout. One workaround is to use minified html without line breaks. But it would be better to be able to just disable the adding of breaks.


Jared14
  • February 19, 2024

Anything further on this?

Still affected by this.


Brett13
  • Community Manager
  • February 20, 2024
Hey Jared, I'm gonna create a ticket on your behalf so our Customer Care team can look into this with you.
 
You'll receive an email shortly stating your ticket has been created.
 
Cheers!

David219
  • April 11, 2024

Hi all.  As noted in the documentation there are instances where gaps or spaces may occur from the html.
Where can I use Markdown and HTML in Zendesk Support



So, if you “minify” your code this should work. Minifying basically means is you just squish it all together in one long string. 
So in the example from this posting, it would look like this instead:  (this should remove any line breaks)

<table><tr><td>This is row 1.</td></tr><tr><td>This is row 2.</td></tr><tr><td>This is row 3.</td></tr><tr><td>This is row 4.</td></tr><tr><td>This is row 5.</td></tr></table>

There are several “minifiers” online that can do this for any type of code including html.