Skip to content

Commit a4a23e2

Browse files
committed
Switch to MarkDig for Markdown handling
1 parent 696db45 commit a4a23e2

File tree

6 files changed

+68
-11
lines changed

6 files changed

+68
-11
lines changed

CSharpCodeAnalyst/Ai/AiAdvisorWindow.xaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Window x:Class="CSharpCodeAnalyst.Ai.AiAdvisorWindow"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:mdXaml="clr-namespace:MdXaml;assembly=MdXaml"
4+
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
55
xmlns:resources="clr-namespace:CSharpCodeAnalyst.Resources"
66
Title="{x:Static resources:Strings.AiAdvisorWindow_Title}"
77
Height="600" Width="700"
@@ -15,10 +15,8 @@
1515
<RowDefinition Height="Auto" />
1616
</Grid.RowDefinitions>
1717

18-
<mdXaml:MarkdownScrollViewer x:Name="MarkdownViewer"
19-
Grid.Row="0"
20-
MarkdownStyleName="GithubLike"
21-
VerticalScrollBarVisibility="Auto"/>
18+
<markdig:MarkdownViewer x:Name="MarkdownViewer"
19+
Grid.Row="0" />
2220

2321
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,6,0,0">
2422
<Button Content="{x:Static resources:Strings.AiAdvisorWindow_Save}" Width="75" Click="SaveButton_Click" Margin="0,0,8,0" />

CSharpCodeAnalyst/Ai/AiAdvisorWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)
5959

6060
if (dialog.ShowDialog() == true)
6161
{
62-
File.WriteAllText(dialog.FileName, MarkdownViewer.Markdown);
62+
File.WriteAllText(dialog.FileName, MarkdownViewer.Markdown ?? string.Empty);
6363
}
6464
}
6565

CSharpCodeAnalyst/CSharpCodeAnalyst.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140

141141
<ItemGroup>
142142
<PackageReference Include="gong-wpf-dragdrop" Version="4.0.0" />
143-
<PackageReference Include="MdXaml" Version="1.27.0" />
143+
<PackageReference Include="Markdig.Wpf" Version="0.5.0.1" />
144144
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.5" />
145145
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.5" />
146146
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.5" />

CSharpCodeAnalyst/Configuration/ApplicationSettings.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ namespace CSharpCodeAnalyst.Configuration;
55

66
public class ApplicationSettings
77
{
8-
private string _defaultProjectExcludeFilter = string.Empty;
98
public int WarningCodeElementLimit { get; set; } = 300;
109

1110

1211
public string DefaultProjectExcludeFilter
1312
{
14-
get => CleanupProjectFilters(_defaultProjectExcludeFilter);
15-
set => _defaultProjectExcludeFilter = CleanupProjectFilters(value);
16-
}
13+
get => CleanupProjectFilters(field);
14+
set => field = CleanupProjectFilters(value);
15+
} = string.Empty;
1716

1817
public bool AutomaticallyAddContainingType { get; set; } = true;
1918

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ Please take note of the following issues:
224224
- Drag and drop functionality is provided by the **gong-wpf-dragdrop** library.
225225
Copyright (c) Jan Karger, Steven Kirk and Contributors. Licensed under BSD-3-Clause.
226226
https://github.com/punker76/gong-wpf-dragdrop
227+
- Markdown rendering in the AI Advisor window is powered by **Markdig.Wpf** and **Markdig**.
228+
Copyright (c) Nicolas Musset and Alexandre Mutel. Licensed under BSD-2-Clause.
229+
https://github.com/Kryptos-FR/markdig.wpf / https://github.com/xoofx/markdig
227230

228231
For complete third-party license information, see the [ThirdPartyNotices](ThirdPartyNotices/) folder.
229232

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
BSD-2-Clause-Licensed Libraries
2+
================================================================================
3+
4+
This file contains the BSD 2-Clause License text for all BSD-2-Clause-licensed
5+
third-party libraries used in this project.
6+
7+
================================================================================
8+
9+
10+
1. MARKDIG.WPF
11+
================================================================================
12+
13+
https://github.com/Kryptos-FR/markdig.wpf
14+
15+
A WPF renderer for the Markdig Markdown processor, used to display
16+
AI advisor output as formatted Markdown in the application.
17+
18+
Copyright (c) 2016-2024 Nicolas Musset
19+
20+
21+
2. MARKDIG
22+
================================================================================
23+
24+
https://github.com/xoofx/markdig
25+
26+
A fast, powerful, CommonMark-compliant Markdown processor for .NET.
27+
Used as the underlying Markdown parsing engine by Markdig.Wpf.
28+
29+
Copyright (c) 2018-2019 Alexandre Mutel
30+
31+
32+
================================================================================
33+
BSD 2-CLAUSE LICENSE TEXT
34+
================================================================================
35+
36+
BSD 2-Clause License
37+
38+
Redistribution and use in source and binary forms, with or without
39+
modification, are permitted provided that the following conditions are met:
40+
41+
1. Redistributions of source code must retain the above copyright notice, this
42+
list of conditions and the following disclaimer.
43+
44+
2. Redistributions in binary form must reproduce the above copyright notice,
45+
this list of conditions and the following disclaimer in the documentation
46+
and/or other materials provided with the distribution.
47+
48+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
49+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
52+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
54+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)