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

Commit 76296ed

Browse files
authored
Merge pull request #1017 from github/fixes/726-markdig
Use markdig for Markdown
2 parents b544ae3 + f5ebd14 commit 76296ed

18 files changed

+133
-1128
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ProjectConfiguration>
2+
<Settings>
3+
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
4+
</Settings>
5+
</ProjectConfiguration>

GitHubVS.v3.ncrunchsolution

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
</AdditionalFilesForGridProcessing>
77
<AdditionalFilesToIncludeForSolution>
88
<Value>lib\**.*</Value>
9+
<Value>packages\Brutal.Dev.StrongNameSigner.2.1.3\build\**.*</Value>
910
</AdditionalFilesToIncludeForSolution>
1011
<AllowParallelTestExecution>False</AllowParallelTestExecution>
1112
<ProjectConfigStoragePathRelativeToSolutionDir>.ncrunch</ProjectConfigStoragePathRelativeToSolutionDir>

src/GitHub.InlineReviews/GitHub.InlineReviews.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@
222222
<HintPath>..\..\packages\LibGit2Sharp.0.22.0\lib\net40\LibGit2Sharp.dll</HintPath>
223223
<Private>True</Private>
224224
</Reference>
225+
<Reference Include="Markdig, Version=0.12.3.0, Culture=neutral, processorArchitecture=MSIL">
226+
<HintPath>..\..\packages\Markdig.0.12.3\lib\net40\Markdig.dll</HintPath>
227+
<Private>True</Private>
228+
</Reference>
229+
<Reference Include="Markdig.Wpf, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL">
230+
<HintPath>..\..\packages\Markdig.Wpf.0.2.0\lib\net45\Markdig.Wpf.dll</HintPath>
231+
<Private>True</Private>
232+
</Reference>
225233
<Reference Include="Microsoft.Build.Framework" />
226234
<Reference Include="Microsoft.CSharp" />
227235
<Reference Include="Microsoft.VisualStudio.CommandBars, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
@@ -427,13 +435,15 @@
427435
</ItemGroup>
428436
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
429437
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != '' And '$(NCrunch)' != '1'" />
438+
<Import Project="..\common\StrongNameSign.targets" />
430439
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
431440
<PropertyGroup>
432441
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
433442
</PropertyGroup>
434443
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.props'))" />
435444
<Error Condition="!Exists('..\..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.targets'))" />
436445
<Error Condition="!Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props'))" />
446+
<Error Condition="!Exists('..\..\packages\Brutal.Dev.StrongNameSigner.2.1.3\build\Brutal.Dev.StrongNameSigner.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Brutal.Dev.StrongNameSigner.2.1.3\build\Brutal.Dev.StrongNameSigner.targets'))" />
437447
</Target>
438448
<Import Project="..\..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.targets" Condition="Exists('..\..\packages\Microsoft.VSSDK.BuildTools.14.3.25407\build\Microsoft.VSSDK.BuildTools.targets')" />
439449
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/GitHub.InlineReviews/Views/CommentView.xaml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xmlns:controls="clr-namespace:GitHub.VisualStudio.UI.Controls;assembly=GitHub.VisualStudio.UI"
88
xmlns:prop="clr-namespace:GitHub.VisualStudio.UI;assembly=GitHub.VisualStudio.UI"
99
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
10+
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
1011
xmlns:sample="clr-namespace:GitHub.InlineReviews.SampleData"
1112
xmlns:views="clr-namespace:GitHub.InlineReviews.Views"
1213
mc:Ignorable="d" d:DesignWidth="300">
@@ -27,21 +28,6 @@
2728
</ResourceDictionary.MergedDictionaries>
2829

2930
<Style TargetType="Button" BasedOn="{StaticResource GitHubVsButton}"/>
30-
31-
<Style x:Key="DocumentStyle" TargetType="FlowDocument">
32-
<Setter Property="FontFamily" Value="Segoe UI"/>
33-
<Setter Property="FontSize" Value="12"/>
34-
<Setter Property="TextAlignment" Value="Left"/>
35-
<Setter Property="PagePadding" Value="0"/>
36-
37-
<Style.Resources>
38-
<Style TargetType="Image">
39-
<Setter Property="Stretch" Value="UniformToFill" />
40-
<Setter Property="StretchDirection" Value="DownOnly" />
41-
<Setter Property="MaxWidth" Value="{Binding Path=ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type ui:MarkdownViewer}}}"/>
42-
</Style>
43-
</Style.Resources>
44-
</Style>
4531
</ResourceDictionary>
4632
</FrameworkElement.Resources>
4733

@@ -86,10 +72,8 @@
8672
</Border>
8773

8874
<Border Background="White" Padding="6 5" BorderThickness="1" BorderBrush="#FFD1D5DA" CornerRadius="0 0 2 2 ">
89-
<ui:MarkdownViewer Grid.Column="1" Grid.Row="1"
90-
DocumentStyle="{StaticResource DocumentStyle}"
91-
RawContent="{Binding Body}"
92-
ScrollViewer.VerticalScrollBarVisibility="Auto"/>
75+
<markdig:MarkdownViewer Grid.Column="1" Grid.Row="1"
76+
Markdown="{Binding Body}"/>
9377
</Border>
9478
</StackPanel>
9579
</Grid>

src/GitHub.InlineReviews/packages.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="Brutal.Dev.StrongNameSigner" version="2.1.3" targetFramework="net461" />
34
<package id="LibGit2Sharp" version="0.22.0" targetFramework="net461" />
45
<package id="LibGit2Sharp.NativeBinaries" version="1.0.129" targetFramework="net461" />
6+
<package id="Markdig" version="0.12.3" targetFramework="net461" />
7+
<package id="Markdig.Wpf" version="0.2.0" targetFramework="net461" />
58
<package id="Microsoft.VisualStudio.CoreUtility" version="14.3.25407" targetFramework="net461" />
69
<package id="Microsoft.VisualStudio.Editor" version="14.3.25407" targetFramework="net461" />
710
<package id="Microsoft.VisualStudio.Imaging" version="14.3.25407" targetFramework="net452" />

src/GitHub.UI/Assets/Markdown.xaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf">
4+
<Style TargetType="{x:Type FlowDocument}" x:Key="{x:Static markdig:Styles.DocumentStyleKey}">
5+
<Setter Property="FontFamily" Value="Segoe UI"/>
6+
<Setter Property="FontSize" Value="12"/>
7+
<Setter Property="TextAlignment" Value="Left"/>
8+
<Setter Property="PagePadding" Value="0"/>
9+
</Style>
10+
<Style TargetType="{x:Type List}">
11+
<Setter Property="Margin" Value="0" />
12+
</Style>
13+
<Style TargetType="{x:Type Paragraph}" x:Key="{x:Static markdig:Styles.Heading1StyleKey}">
14+
<Setter Property="FontSize" Value="19" />
15+
<Setter Property="Foreground" Value="#ff000000" />
16+
<Setter Property="FontWeight" Value="Light" />
17+
</Style>
18+
<Style TargetType="{x:Type Paragraph}" x:Key="{x:Static markdig:Styles.Heading2StyleKey}">
19+
<Setter Property="FontSize" Value="17" />
20+
<Setter Property="Foreground" Value="#ff000000" />
21+
<Setter Property="FontWeight" Value="Light" />
22+
</Style>
23+
<Style TargetType="{x:Type Paragraph}" x:Key="{x:Static markdig:Styles.Heading3StyleKey}">
24+
<Setter Property="FontSize" Value="16" />
25+
<Setter Property="Foreground" Value="#99000000" />
26+
<Setter Property="FontWeight" Value="Light" />
27+
</Style>
28+
<Style TargetType="{x:Type Paragraph}" x:Key="{x:Static markdig:Styles.Heading4StyleKey}">
29+
<Setter Property="FontSize" Value="14" />
30+
<Setter Property="Foreground" Value="#99000000" />
31+
<Setter Property="FontWeight" Value="Light" />
32+
<Setter Property="TextDecorations" Value="Underline" />
33+
</Style>
34+
<Style TargetType="{x:Type Table}" x:Key="{x:Static markdig:Styles.TableStyleKey}">
35+
<Setter Property="BorderBrush" Value="{DynamicResource GitHubHeaderSeparatorBrush}"/>
36+
<Setter Property="BorderThickness" Value="0,0,1,1"/>
37+
<Setter Property="CellSpacing" Value="0"/>
38+
</Style>
39+
<Style TargetType="{x:Type TableCell}" x:Key="{x:Static markdig:Styles.TableCellStyleKey}">
40+
<Setter Property="BorderBrush" Value="{DynamicResource GitHubHeaderSeparatorBrush}"/>
41+
<Setter Property="BorderThickness" Value="1,1,0,0"/>
42+
<Setter Property="Padding" Value="4"/>
43+
</Style>
44+
</ResourceDictionary>

0 commit comments

Comments
 (0)