Skip to content

Commit

Permalink
Add hover card to preview to repositories (OctoLinker#869)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Buck <[email protected]>
  • Loading branch information
stefanbuck and Stefan Buck authored Apr 12, 2020
1 parent 9ddbd77 commit cd37b3f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ function insertLinks({

if (finalUrl && finalUrl.result) {
link.href = finalUrl.result;

if (finalUrl.result.startsWith('https://github.com')) {
[, , , user, repo] = finalUrl.result.split('/');
link.dataset.repositoryHovercardsEnabled = true;
link.dataset.hovercardType = 'repository';
link.dataset.hovercardUrl = `/${user}/${repo}/hovercard`;
}

if (process.env.OCTOLINKER_LIVE_DEMO) {
link.href = injectLiveDemoUrl(link.href);
}
Expand Down

0 comments on commit cd37b3f

Please sign in to comment.