Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit b973124

Browse files
Adding functionality to link markdown
1 parent c2f8b3e commit b973124

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/GitHub.VisualStudio.UI/Views/GitHubPane/PullRequestAnnotationsView.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,8 @@
129129
</DockPanel>
130130
</ScrollViewer>
131131

132+
<FrameworkElement.CommandBindings>
133+
<CommandBinding Command="{x:Static markdig:Commands.Hyperlink}" Executed="OpenHyperlink" />
134+
</FrameworkElement.CommandBindings>
132135
</UserControl>
133136

src/GitHub.VisualStudio.UI/Views/GitHubPane/PullRequestAnnotationsView.xaml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,21 @@ public PullRequestAnnotationsView()
1818
{
1919
InitializeComponent();
2020
}
21+
22+
IVisualStudioBrowser GetBrowser()
23+
{
24+
var serviceProvider = (IGitHubServiceProvider)Package.GetGlobalService(typeof(IGitHubServiceProvider));
25+
return serviceProvider.GetService<IVisualStudioBrowser>();
26+
}
27+
28+
void OpenHyperlink(object sender, ExecutedRoutedEventArgs e)
29+
{
30+
Uri uri;
31+
32+
if (Uri.TryCreate(e.Parameter?.ToString(), UriKind.Absolute, out uri))
33+
{
34+
GetBrowser().OpenUrl(uri);
35+
}
36+
}
2137
}
2238
}

0 commit comments

Comments
 (0)