Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting is broken when comments are continued on GitHub #111

Closed
timoguin opened this issue Apr 21, 2018 · 6 comments
Closed

Formatting is broken when comments are continued on GitHub #111

timoguin opened this issue Apr 21, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@timoguin
Copy link
Contributor

When long Terraform plan output gets split into multiple comments on GitHub, the Markdown formatting is unrendered in the subsequent comments.

Here's a screenshot with some example output:

screen shot 2018-04-21 at 10 04 07 am

@timoguin
Copy link
Contributor Author

It seems this is due to splitting the comment after the Markdown has been rendered. I'm guessing the second comment needs the triple backticks (```) that get stripped out.

Markdown rendering and comment creation are done here:

comment := c.MarkdownRenderer.Render(res, ctx.Command.Name, ctx.Log.History.String(), ctx.Command.Verbose)
c.VCSClient.CreateComment(ctx.BaseRepo, ctx.Pull.Num, comment) // nolint: errcheck

Splitting is done here:

comments := g.splitAtMaxChars(comment, maxCommentBodySize, "\ncontinued...\n")
for _, c := range comments {
_, _, err := g.client.Issues.CreateComment(g.ctx, repo.Owner, repo.Name, pullNum, &github.IssueComment{Body: &c})
if err != nil {
return err
}
}

@lkysow
Copy link
Member

lkysow commented Apr 26, 2018

Yes my initial solution was a bit hacky. This needs to be cleaned up.

@julianvmodesto
Copy link

julianvmodesto commented Oct 11, 2018

Looks like this needs to take into account #251. For long outputs spread across 2 comments, I have seen that the first output renders okay and is in a collapsed block (as implemented in #251), but the second comment is not formatted nicely, as in this issue.

@sstarcher
Copy link

I'm seeing the same behavior as @julianvmodesto

@majormoses
Copy link
Contributor

Ya its a known issue not sure the priority /cc @lkysow

@lkysow
Copy link
Member

lkysow commented Oct 26, 2018

If anyone has bandwidth to take a look that would be great. #203 was started but never finished.

Simply removing the Refreshing.... lines might be a quick-win and move lots of plans under the character limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants