Skip to content

Commit defce5d

Browse files
author
msftbot[bot]
authored
Remove parsers (#3759)
<!-- 🚨 Please Do Not skip any instructions and information mentioned below as they are all required and essential to evaluate and test the PR. By fulfilling all the required information you will be able to reduce the volume of questions and most likely help merge the PR faster 🚨 --> <!-- 📝 It is preferred if you keep the "☑️ Allow edits by maintainers" checked in the Pull Request Template as it increases collaboration with the Toolkit maintainers by permitting commits to your PR branch (only) created from your fork. This can let us quickly make fixes for minor typos or forgotten StyleCop issues during review without needing to wait on you doing extra work. Let us help you help us! 🎉 --> ## Fixes #3744 <!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. --> <!-- Add a brief overview here of the feature/bug & fix. --> Move Parsing code from `Microsoft.Toolkit.Parsers` into `Microsoft.Toolkit.Uwp.UI.Controls.Markdown`. Make parsing code internal as we don't want anyone using our parsers. Remove sample `MarkdownParserPage` as it directly uses our parser. ## PR Type What kind of change does this PR introduce? <!-- Please uncomment one or more that apply to this PR. --> <!-- - Bugfix --> <!-- - Feature --> <!-- - Code style update (formatting) --> - Refactoring (no functional changes, no api changes) <!-- - Build or CI related changes --> <!-- - Documentation content changes --> - Sample app changes <!-- - Other... Please describe: --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> ## What is the new behavior? <!-- Describe how was this issue resolved or changed? --> ## PR Checklist Please check if your PR fulfills the following requirements: - [ ] Tested code with current [supported SDKs](../readme.md#supported) - [ ] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link --> - [ ] Sample in sample app has been added / updated (for bug fixes / features) - [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets) - [ ] New major technical changes in the toolkit have or will be added to the [Wiki](https://github.com/windows-toolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc... - [ ] Tests for the changes have been added (for bug fixes / features) (if applicable) - [ ] Header has been added to all new source files (run *build/UpdateHeaders.bat*) - [ ] Contains **NO** breaking changes <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. Please note that breaking changes are likely to be rejected within minor release cycles or held until major versions. --> ## Other information
2 parents 3d5860f + aa12b00 commit defce5d

File tree

90 files changed

+169
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+169
-223
lines changed

Microsoft.Toolkit.Parsers/Microsoft.Toolkit.Parsers.csproj

Lines changed: 0 additions & 19 deletions
This file was deleted.

Microsoft.Toolkit.Uwp.SampleApp/Controls/SampleAppMarkdownRenderer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Controls
2525
/// </summary>
2626
internal class SampleAppMarkdownRenderer : MarkdownRenderer
2727
{
28+
#pragma warning disable CS0618 // Type or member is obsolete
2829
public SampleAppMarkdownRenderer(MarkdownDocument document, ILinkRegister linkRegister, IImageResolver imageResolver, ICodeBlockResolver codeBlockResolver)
2930
: base(document, linkRegister, imageResolver, codeBlockResolver)
3031
{
@@ -514,5 +515,6 @@ private class CustomCodeBlock
514515

515516
public string CurrentLanguage { get; set; }
516517
}
518+
#pragma warning restore CS0618 // Type or member is obsolete
517519
}
518520
}

Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -745,9 +745,6 @@
745745
<Compile Include="SamplePages\ListViewExtensions\ListViewExtensionsPage.xaml.cs">
746746
<DependentUpon>ListViewExtensionsPage.xaml</DependentUpon>
747747
</Compile>
748-
<Compile Include="SamplePages\MarkdownParser\MarkdownParserPage.xaml.cs">
749-
<DependentUpon>MarkdownParserPage.xaml</DependentUpon>
750-
</Compile>
751748
<Compile Include="SamplePages\Menu\Commands\VsCommands.cs" />
752749
<Compile Include="SamplePages\Menu\MenuPage.xaml.cs">
753750
<DependentUpon>MenuPage.xaml</DependentUpon>
@@ -1175,10 +1172,6 @@
11751172
<SubType>Designer</SubType>
11761173
<Generator>MSBuild:Compile</Generator>
11771174
</Page>
1178-
<Page Include="SamplePages\MarkdownParser\MarkdownParserPage.xaml">
1179-
<SubType>Designer</SubType>
1180-
<Generator>MSBuild:Compile</Generator>
1181-
</Page>
11821175
<Page Include="SamplePages\Mouse\MouseCursorPage.xaml">
11831176
<Generator>MSBuild:Compile</Generator>
11841177
<SubType>Designer</SubType>
@@ -1401,10 +1394,6 @@
14011394
</Page>
14021395
</ItemGroup>
14031396
<ItemGroup>
1404-
<ProjectReference Include="..\Microsoft.Toolkit.Parsers\Microsoft.Toolkit.Parsers.csproj">
1405-
<Project>{42CA4935-54BE-42EA-AC19-992378C08DE6}</Project>
1406-
<Name>Microsoft.Toolkit.Parsers</Name>
1407-
</ProjectReference>
14081397
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.Connectivity\Microsoft.Toolkit.Uwp.Connectivity.csproj">
14091398
<Project>{b1e850ff-dde6-44d5-a830-34250e97a687}</Project>
14101399
<Name>Microsoft.Toolkit.Uwp.Connectivity</Name>

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/MarkdownParser/MarkdownParserPage.xaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/MarkdownParser/MarkdownParserPage.xaml.cs

Lines changed: 0 additions & 48 deletions
This file was deleted.

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -857,14 +857,6 @@
857857
"Icon": "/Assets/Helpers.png",
858858
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/behaviors/FocusBehavior.md"
859859
},
860-
{
861-
"Name": "Markdown Parser",
862-
"Type": "MarkdownParserPage",
863-
"Subcategory": "Parser",
864-
"About": "The Markdown Parser allows you to parse a Markdown String into a Markdown Document, and then Render it with a Markdown Renderer.",
865-
"Icon": "/Assets/Helpers.png",
866-
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/parsers/MarkdownParser.md"
867-
},
868860
{
869861
"Name": "Win2d Path Mini Language Parser",
870862
"Type": "CanvasPathGeometryPage",

Microsoft.Toolkit.Uwp.UI.Controls.Markdown/MarkdownTextBlock/MarkdownTextBlock.Methods.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ private void RenderMarkdown()
6363
try
6464
{
6565
// Try to parse the markdown.
66+
#pragma warning disable CS0618 // Type or member is obsolete
6667
MarkdownDocument markdown = new MarkdownDocument();
6768
foreach (string str in SchemeList.Split(',').ToList())
6869
{
@@ -71,6 +72,7 @@ private void RenderMarkdown()
7172
MarkdownDocument.KnownSchemes.Add(str);
7273
}
7374
}
75+
#pragma warning restore CS0618 // Type or member is obsolete
7476

7577
markdown.Parse(Text);
7678

Microsoft.Toolkit.Uwp.UI.Controls.Markdown/Microsoft.Toolkit.Uwp.UI.Controls.Markdown.csproj

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,8 @@
1717
<None Include="$(OutDir)\Design\$(MSBuildProjectName).Design*.dll;$(OutDir)\Design\$(MSBuildProjectName).Design*.pdb" Pack="true" PackagePath="lib\$(TargetFramework)\Design" />
1818
</ItemGroup>
1919

20-
<ItemGroup>
21-
<Compile Update="Properties\Resources.Designer.cs">
22-
<DesignTime>True</DesignTime>
23-
<AutoGen>True</AutoGen>
24-
<DependentUpon>Resources.resx</DependentUpon>
25-
</Compile>
26-
</ItemGroup>
27-
28-
<ItemGroup>
29-
<EmbeddedResource Update="Properties\Resources.resx">
30-
<Generator>ResXFileCodeGenerator</Generator>
31-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
32-
</EmbeddedResource>
33-
</ItemGroup>
34-
3520
<ItemGroup>
3621
<PackageReference Include="ColorCode.UWP" Version="2.0.6" />
37-
<ProjectReference Include="..\Microsoft.Toolkit.Parsers\Microsoft.Toolkit.Parsers.csproj" />
3822
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Core\Microsoft.Toolkit.Uwp.UI.Controls.Core.csproj" />
3923
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI\Microsoft.Toolkit.Uwp.UI.csproj" />
4024
</ItemGroup>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace Microsoft.Toolkit.Parsers
6+
{
7+
internal static class Constants
8+
{
9+
internal const string ParserObsoleteMsg = "Parsing code has been deprecated, we suggest using Markdig. See https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3200 for more info.";
10+
}
11+
}

Microsoft.Toolkit.Parsers/Core/IParser.cs renamed to Microsoft.Toolkit.Uwp.UI.Controls.Markdown/Parsers/Core/IParser.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System;
56
using System.Collections.Generic;
67

78
namespace Microsoft.Toolkit.Parsers
@@ -10,6 +11,7 @@ namespace Microsoft.Toolkit.Parsers
1011
/// Parser interface.
1112
/// </summary>
1213
/// <typeparam name="T">Type to parse into.</typeparam>
14+
[Obsolete(Constants.ParserObsoleteMsg)]
1315
public interface IParser<out T>
1416
where T : SchemaBase
1517
{

0 commit comments

Comments
 (0)