# Email replies truncated at code fences with tildes

**URL:** https://meta.discourse.org/t/email-replies-truncated-at-code-fences-with-tildes/143198
**Category:** Bug
**Created:** [March 3, 2020, 12:45pm UTC](https://meta.discourse.org/t/email-replies-truncated-at-code-fences-with-tildes/143198 "2020-03-03T12:45:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![brad.king](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brad.king/32/171619_2.png) [@brad.king](https://meta.discourse.org/u/brad.king)
#### Post date: [March 3, 2020, 12:45pm UTC](https://meta.discourse.org/t/email-replies-truncated-at-code-fences-with-tildes/143198/1 "2020-03-03T12:45:54Z")

</div>

Code fences with `~~~` have been supported in the forum since at least 2017:

> [@Fenced code blocks don't work with ~~~…~~~](https://meta.discourse.org/t/fenced-code-blocks-dont-work-with/28219):
>
> Both triple ` and ~ should be supported as the start and end of fenced code blocks but only backticks seem to work here. This is a fenced code block This is a fenced code block

However, when replying by email the reply trimmer truncates messages on `~~~` lines, likely mistaking them for delimiters. For example, sending the literal source text

```md
Prose before fenced code.

~~~
Fenced Code
~~~

Prose after fenced code.

```

results in a post containing just “Prose before fenced code.”. Using a fence of back-ticks works fine.

---

<div class="post-metadata">

### Author: ![brad.king](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brad.king/32/171619_2.png) [@brad.king](https://meta.discourse.org/u/brad.king)
#### Post date: [March 3, 2020, 12:46pm UTC](https://meta.discourse.org/t/email-replies-truncated-at-code-fences-with-tildes/143198/2 "2020-03-03T12:46:35Z")

</div>

IIUC discourse uses `github.com/discourse/email_reply_trimmer` to parse emails. The [code here](https://github.com/discourse/email_reply_trimmer/blob/c3e2988fb663857f72bfb85dacff035fbf4e2778/lib/email_reply_trimmer/delimiter_matcher.rb) looks like it will consider a line of `~` characters to be a delimiter, and that is [used here](https://github.com/discourse/email_reply_trimmer/blob/c3e2988fb663857f72bfb85dacff035fbf4e2778/lib/email_reply_trimmer.rb#L42) to remove everything following it.
