Email trimming improvement (no trimming in code blocks)

I’ve also opened a GitHub issue about this, but I wanted to post it here as well in case more folks are watching:

I think it’d be great if the email trimming logic could be improved to avoid trimming within code blocks. So for example in an email containing:

# This should not be deleted
#
# Or trimmed
# It is code
####
Code code code

Everything below the first ‘#’ is trimmed. That’s a bit inconvenient, as many folks use comment markers to break sections of their code, sometimes even in multi-line strings for printing. It also has the convenient feature that if folks want to copy-paste program output into an email and that output includes such lines, the email will not be trimmed at them if the program output is encased in ticks. Is there any chance this is a common enough issue that someone might have a moment to see if it could be improved? I’ve gotten as far as the regex where the matching happens, but I’m not sure how complex adding an exception for code blocks would be.

Thanks!