Best practices: ascii separators in emails?

Hi Discourse Community —

First, thanks for creating what I’m finding to be a great, valuable, flexible, and (mostly) intuitive tool. We’re working on changing a number of our project’s communication modes over to using Discourse, from user-based community discussion mailing lists to script-generated emails notifying us of key events (new issues, test failures, etc.), and are excited about the changes.

One of the hitches that I’ve run into in getting things set up is the auto-stripping of content following lines like ----- in emails sent to Discourse. If I understand correctly, this is done to avoid having posts made via email carry the whole chain of replies along with them, and I’ve generally been impressed with how cleanly email-based replies render in Discourse, so am not knocking that choice at all in this question.

We’ve traditionally used such separators frequently in script-generated notification emails (which we’re now reflecting to Discourse) to make them easy to read whether using old- or new-school technologies. I’m in the process of removing them and replacing them with techniques like “let’s just try using more vertical whitespace instead”, but before I get too far into that effort, I wanted to check and see whether there is some other suggested best practice for creating such separators in email sent to Discourse, or some way to escape them / sneak them past the current filter that I hadn’t found (my best attempt so far has been to use a line of n-dashes rather than hyphens/ascii minuses, but I’m not keen on going to non-ascii characters, for simplicity).

A number of us also tend to habitually use little --- separators in mails to set apart a code block or something like that, so I worry that even once I’ve got all our script-generated messages converted, that this will bite users who rely on the reply-to option to respond to Discourse topics reflected to their inboxes (but maybe that’s just a learning curve we’ll need to get over?).

Thanks for any tips / advice here,
-Brad

3 Likes

Aha… something I just discovered myself that may help others who find their way to this thread: Mixing non-separator/punctuation ascii symbols into a line that otherwise acts as a separator causes it to pass Discourse’s filtering. So changing a line like:

Header
--------------------------------

To:

--- Header ---------------------

is one way to preserve some form of separator line without having Discourse strip it out. Of course, this still doesn’t help for users who are accustomed to relying on little ---- separator lines to set something apart in an email, so I’m still curious whether others have recommended best practices here.

6 Likes

At the risk of continuing to talk to myself, here’s a specific motivating example that we ran into today:

One of the cases where we use scripts to notify people of events is to mail developers when new PRs are merged to our GitHub repository. We’ve now changed these scripts to mail to a specific category on our Discourse site. However, since GitHub uses markdown to describe PRs, we often have section headers like the following in our PR descriptions:

Details of this PR
------------------

which get rendered as section headers on GitHub. But when mailed to Discourse, this line of dashes causes the rest of the message to get trimmed.

We could obviously train all our developers to use other styles of headers instead that would not be trimmed (like ## Details of this PR), but if there were some way for us to modify our script to process the merge message and protect or escape such patterns so that they would be preserved through into Discourse, that seems more attractive.

1 Like