Often when an editor removes content from an email, it would also help to also remove related HTML code. A good example is a headline | typically if a user removes a headline from a module, we also want to remove some of the padding around it, to avoid extra space being left in the email.

We can do this in Taxi using the rule attribute. In the example below we have an editable, in this case a piece of text. It's wrapped in a table tag so that we can add some padding around it.

<table>
<tr>
<td style="padding:20px;">
<editable name="headline" label="Headline">This is the headline</editable>
</td>
</tr>
</table>

Looking at the implied default snippet for editable text, we can see that the field for the piece of text is called "content".

We can then use a rule to reference this piece of content. In this example, the remove_unless rule will remove the tag, and it's entire contents, unless there is content for a given field | in this case the content field. Because the rule is outside of the editable, we have to first reference the editable name.

<table rule="{% remove_unless editables.headline.content %}">

See more about how rules work and referencing fields.

Complete Snippet

HTML

<table rule="{% remove_unless editables.headline.content %}">
<tr>
<td style="padding:20px;">
<editable name="headline" label="Headline">This is the headline</editable>
</td>
</tr>
</table>