Skip to content

Linkify issue and PR refs in issue and PR titles - #61

Closed
hkdobrev wants to merge 1 commit into
masterfrom
link-issues
Closed

hkdobrev wants to merge 1 commit into
masterfrom
link-issues

Conversation

@hkdobrev

@hkdobrev hkdobrev commented Mar 7, 2016

Copy link
Copy Markdown
Contributor

See isaacs/github#568

This aims to fix the most common case in a simple manner.

  • It links to PRs using GitHub redirect from issues/1 to pull/1
  • It does not re-link when you edit a title unless you reload the page
  • It links when the issue or PR does not exist
  • It does not show title of issue/PR on hover like other issue/PR links
  • It does not check permissions
  • It links even text like #1foo
  • It does not support cross-repo and cross-fork links

@hkdobrev

hkdobrev commented Mar 7, 2016

Copy link
Copy Markdown
Contributor Author

Example test case: hkdobrev/github-test#5

@paulmolluzzo

Copy link
Copy Markdown
Contributor

It links to PRs using GitHub redirect from issues/1 to pull/1

Do these numbers match often? Look at this PR

It does not show title of issue/PR on hover like other issue/PR links

Isn't fairly simple to add a title attribute like "Issue #123"

It links even text like #1foo

Why not use Regex to ensure there's a space? Or is that intentional?

It does not support cross-repo and cross-fork links

I don't think anyone would make a PR on a repo and refer to an issue on a fork, the issue and PR would be on the upstream.

@hkdobrev

hkdobrev commented Mar 8, 2016

Copy link
Copy Markdown
Contributor Author

@paulmolluzzo All of the limitations were intentional.

Isn't fairly simple to add a title attribute like "Issue #123"

When you link to an issue from a comment, GitHub renders it with the title attribute set to the title of the issue. This is not something we can do on the front-end without network requests for each issue. That's what I meant by not adding titles - not adding the titles which GitHub is adding on some places.

It links to PRs using GitHub redirect from issues/1 to pull/1

Do these numbers match often? Look at this PR

I don't get what you mean here.
I meant that instead of checking whether a number refers to an issue or a PR, it will link everything to /issues/ and then GitHub would redirect the pull requests to /pull/...

@paulmolluzzo

Copy link
Copy Markdown
Contributor

OK, I understand both points now, and they make sense.

I'll give it a test in a bit and comment if I notice bugs.

@paulmolluzzo

Copy link
Copy Markdown
Contributor

👍 Looks good to me and is a useful feature!

You might want to see my comment on #64 about not working when you edit a title until you refresh.

@sindresorhus

Copy link
Copy Markdown
Member

Yay! I've been wanting this too. Looks good :)

Can you add it to the readme feature list?

See isaacs/github#568

This aims to fix the most common case in a simple manner.

- It links to PRs using GitHub redirect from issues/1 to pull/1
- It does not re-link when you edit a title unless you reload the page
- It links when the issues or PR does not exist
- It does not show title of issue/PR on hover like other issue/PR links
- It does not check permissions
- It links even text like #1foo
- It does not support cross-repo and cross-fork links
@hkdobrev

hkdobrev commented Mar 8, 2016

Copy link
Copy Markdown
Contributor Author

@sindresorhus ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants