Githawk: Support non-explicit links

Created on 15 Jul 2017  ·  16Comments  ·  Source: GitHawkApp/GitHawk

GitHub is smart enough to link automagically based on contents, a few examples:

52

1

(#1)
[#1]

1

-#1-
abc#1
#1
#1
#1

  • #1
  • [ ] #1

1

#1

Mid sentence #1

GH-52
GH-1
(GH-1)
gh-52
gh-1
(gh-1)

Instagram/IGListKit#796
(Instagram/IGListKit#796)
46f1af9
46f1af9479b5b13d929937730d766546c7584aa5
(46f1af9)
Instagram/IGListKit@0f04a073194033fbfc6f1d916fad83838042a7c0

🐛 bug

All 16 comments

App seems to format the comment weirdly, but doesn't link any of them

Also the deleted event above doesn't render in-app

https://github.com/rnystrom/GitHawk/commit/81a9a167cedf23fd47e3eb740434c2347f9fd443 fulfills part of this work - left a comment on it with how a small improvement should cover a few more of the above examples

@rnystrom Don't know if we want to do it as part of this issue or create a new one, but we should definitely support full URLs and collapsing them down and handling them natively

E.g.
"https://github.com/rnystrom/GitHawk/issues/146" is actually the full URL, but GitHub (desktop) renders it as just the #146. We should do this, and also instead of opening the link in Safari - open it natively!

Same obviously goes for repositories, pull requests, cross-origin, etc

@Sherlouk mind spinning up a new issue for that? I absolutely want to support that.

Sent with GitHawk

Regex for GIT hashes: \b[0-9a-f]{4,40}\b

A quick playing around and looks like GitHub will work with 4 or more values of the hash

https://github.com/rnystrom/GitHawk/commit/cee
https://github.com/rnystrom/GitHawk/commit/cee3

Re-hashes, won’t that match _any_ word that is 4+ characters?

Sent with GitHawk

Hmm yes...

1a2b3c4

They must do some lookup to check if the commit exists 🤔 Makes sense I suppose

Also updated root object with addressing hashes cross-repo

Ya probably. We might want to punt on hashes for the time being. At the very least we can take has URLs and convert them to 7 character links.

Sent with GitHawk

@rnystrom Can probably remove this from 1.11 as supporting commits is going to be a fair bit of work -- Got better support for issue references though!

Also found out the regex needs to be calmed down a little bit, it's not picking up issues/prs when the
#123 is in brackets (#123) but GitHub does support this!

bump for easy reference

psst bookmark it 😉

Just updated root with a bunch more test situations as well, good to check at least!

Looks like you can have any non-alphanumeric character before/after the issue reference

Works pretty well atm

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BasThomas picture BasThomas  ·  3Comments

weyert picture weyert  ·  3Comments

BasThomas picture BasThomas  ·  3Comments

BasThomas picture BasThomas  ·  3Comments

rnystrom picture rnystrom  ·  3Comments