Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

Additional newlines added in email notifications form PR comments

I have authored a GitHub application that leaves comments on pull requests. (http://github.com/apps/pulumi) Those comments typically included code blocks in markdown snippets, which specific to my GitHub app is the set of changes that would be applied to cloud infrastructure. For example:

## Resource Changes
```diff
Name Type Operation
>- rootDomain aws:route53/zone:Zone read
-+ apiTaskDefinition aws:ecs/taskDefinition:TaskDefinition replaced
-+ consoleTaskDefinition aws:ecs/taskDefinition:TaskDefinition replaced
~ api- aws:ecs/service:Service update
~ console- aws:ecs/service:Service update
~ dashboard aws:cloudwatch/dashboard:Dashboard update
>- certificate aws:acm/certificate:Certificate read
```

 

The problem is that when this GitHub flavored markdown gets rendered as an email and sent to subscribers of the pull request, GitHub is formatting the code snippet incorrectly.

 

Specifically, in the text-version of the email it is correct. But in the HTML-version of the same email additional newlines are added:

 

<div class=3D"highlight highlight-source-diff"><pre>    Name               =
    Type                                   Operation

&gt;-  rootDomain             aws:route53/zone:Zone                  read

*   apiTaskDefinition      aws:ecs/taskDefinition:TaskDefinition  replaced

*   consoleTaskDefinition  aws:ecs/taskDefinition:TaskDefinition  replaced

~   api-                   aws:ecs/service:Service                update

~   console-               aws:ecs/service:Service                update

~   dashboard              aws:cloudwatch/dashboard:Dashboard     update

&gt;-  certificate            aws:acm/certificate:Certificate        read

</pre></div>

This makes the email notifications from my GitHub app look pretty bad.

 

Is this a bug in the way GitHub is converting code blocks into HTML emails? Is there something I can do on my end to prevent these additional newlines from being added to the HTML-variants of PR emails?

1 Reply
Community Manager
Message 2 of 2

Re: Additional newlines added in email notifications form PR comments

Just a quick stab in the dark, but is it possible that you're on a Windows machine and this is a newline problem?

 

I'll keep thinking about this and come back to it, but I wanted to ask the question first 😀