slapperwan / gh4a

Github client for Android
Apache License 2.0
1.68k stars 221 forks source link

[Feature request] linkify # in commits #1028

Open B0pol opened 4 years ago

B0pol commented 4 years ago

number should be current repo issue / pull request number

And repo-owner/repo#number should be https://github.com/repo-owner/repo/issues/number or https://github.com/repo-owner/repo/pull/number

For example: https://github.com/darkreader/darkreader/commit/8d4ee65ef3a0878309d8d7de5f5b20f169f6f5bf

Currently it works, but for issue comments, e.g. #1 npm/npm#1

Fs00 commented 3 years ago

@maniac103 I was looking into how this could be implemented, and the simpler way I could think of is using the GitHub Markdown API to format the commit message with autolinks. The only drawback is that the message would be also Markdown-formatted, but I don't think it's a big problem considering that commit messages contain at most some basic Markdown features.

maniac103 commented 3 years ago

That sounds like a good solution for overview activities/fragments. For lists it's not an option though. When doing that, we should do it for everything: commit messages, issue/PR descriptions (if not sent like that from the API already), gist descriptions etc.

Fs00 commented 3 years ago

For lists it's not an option though.

Totally agree, my idea was to add it only to the commit activity.

When doing that, we should do it for everything: commit messages, issue/PR descriptions (if not sent like that from the API already), gist descriptions etc.

Issues/PRs descriptions come already formatted with autolinks from the API, and I don't know whether it's worth adding formatting to Gist descriptions (I've never seen autolinks or Markdown in them). In any case I'll start with commit messages, we'll decide on other things later.

Fs00 commented 2 years ago

I think I won't work on this anytime soon. For those interested in implementing this, I've found out that there's a proper way to get the formatted commit message with autolinks: the GraphQL API exposes the messageHeadlineHTML and messageBodyHTML fields on Commit objects which are exactly what we need here.