Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
whistyun committed Jan 5, 2024
2 parents 8d86aba + 29ef5fd commit bf5cba0
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
<PackageTargetFrameworks>net45;netcoreapp3.0;net6.0-windows</PackageTargetFrameworks>
<SampleTargetFrameworks>netcoreapp3.0;net461;net6.0-windows</SampleTargetFrameworks>
<TestTargetFrameworks>net461;net6.0-windows</TestTargetFrameworks>
<PackageVersion>1.21.0</PackageVersion>
<PackageVersion>1.22.0</PackageVersion>
</PropertyGroup>
</Project>
40 changes: 40 additions & 0 deletions MdXaml.Full/Markdown.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using MdXaml.AnimatedGif;
using MdXaml.Html;
using MdXaml.Plugins;
using MdXaml.Svg;
using System.Collections.Generic;
using System.Linq;

namespace MdXaml.Full
{
public class Markdown : MdXaml.Markdown
{
public override MdXamlPlugins? Plugins
{
get => base.Plugins;
set
{
var nplg = value is null ? new MdXamlPlugins() : value;

AddIfAbsent<HtmlPluginSetup>(nplg.Setups);
AddIfAbsent<SvgPluginSetup>(nplg.Setups);
AddIfAbsent<AnimatedGifPluginSetup>(nplg.Setups);

base.Plugins = nplg;
}
}

public Markdown()
{
Plugins = new MdXamlPlugins();
}

private void AddIfAbsent<T>(IList<IPluginSetup> plugins) where T : IPluginSetup, new()
{
if (!plugins.Any(p => p is T))
{
plugins.Add(new T());
}
}
}
}
43 changes: 43 additions & 0 deletions MdXaml.Full/MarkdownScrollViewer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using MdXaml.AnimatedGif;
using MdXaml.Html;
using MdXaml.Plugins;
using MdXaml.Svg;
using Svg;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace MdXaml.Full
{
public class MarkdownScrollViewer : MdXaml.MarkdownScrollViewer
{
public override MdXamlPlugins? Plugins
{
get => base.Plugins;
set
{
var nplg = value is null ? new MdXamlPlugins() : value;

AddIfAbsent<HtmlPluginSetup>(nplg.Setups);
AddIfAbsent<SvgPluginSetup>(nplg.Setups);
AddIfAbsent<AnimatedGifPluginSetup>(nplg.Setups);

base.Plugins = nplg;
}
}

public MarkdownScrollViewer()
{
Plugins = new MdXamlPlugins();
}

private void AddIfAbsent<T>(IList<IPluginSetup> plugins) where T : IPluginSetup, new()
{
if (!plugins.Any(p => p is T))
{
plugins.Add(new T());
}
}
}
}
37 changes: 37 additions & 0 deletions MdXaml.Full/MdXaml.Full.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>$(PackageTargetFrameworks)</TargetFrameworks>
<UseWPF>true</UseWPF>
<PackageId>MdXaml.Full</PackageId>
<Version>$(PackageVersion)</Version>
<Authors>Bevan Arps(original); whistyun</Authors>
<Company />
<Description>Markdown XAML processor</Description>
<Copyright>Copyright (c) 2010 Bevan Arps, 2023 whistyun</Copyright>
<PackageProjectUrl>https://github.com/whistyun/MdXaml</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>MdXaml.Full.md</PackageReadmeFile>
<PackageTags>Markdown WPF Xaml FlowDocument</PackageTags>
<Configurations>Debug;Release</Configurations>
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\pack_readme\MdXaml.Full.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MdXaml.AnimatedGif\MdXaml.AnimatedGif.csproj" />
<ProjectReference Include="..\MdXaml.Html\MdXaml.Html.csproj" />
<ProjectReference Include="..\MdXaml.Plugins\MdXaml.Plugins.csproj" />
<ProjectReference Include="..\MdXaml.Svg\MdXaml.Svg.csproj" />
<ProjectReference Include="..\MdXaml\MdXaml.csproj" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions MdXaml.Full/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

using System.Windows.Markup;

[assembly: XmlnsDefinition("https://github.com/whistyun/MdXaml.Full", "MdXaml.Full")]
8 changes: 7 additions & 1 deletion MdXaml.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MdXaml.Html.Test", "tests\M
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MdXaml.Plugins", "MdXaml.Plugins\MdXaml.Plugins.csproj", "{823DB5D5-17C0-4418-895C-A28DD7D04CE9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MdXaml.AnimatedGif", "MdXaml.AnimatedGif\MdXaml.AnimatedGif.csproj", "{A7666AD6-CB44-4399-AC61-05DE80D65F9D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MdXaml.AnimatedGif", "MdXaml.AnimatedGif\MdXaml.AnimatedGif.csproj", "{A7666AD6-CB44-4399-AC61-05DE80D65F9D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MdXaml.Full", "MdXaml.Full\MdXaml.Full.csproj", "{0ABF174B-B7EA-4225-BB56-5A6E8C011CFB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -84,6 +86,10 @@ Global
{A7666AD6-CB44-4399-AC61-05DE80D65F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7666AD6-CB44-4399-AC61-05DE80D65F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7666AD6-CB44-4399-AC61-05DE80D65F9D}.Release|Any CPU.Build.0 = Release|Any CPU
{0ABF174B-B7EA-4225-BB56-5A6E8C011CFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0ABF174B-B7EA-4225-BB56-5A6E8C011CFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0ABF174B-B7EA-4225-BB56-5A6E8C011CFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0ABF174B-B7EA-4225-BB56-5A6E8C011CFB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion MdXaml/Markdown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class Markdown : DependencyObject, IMarkdown, IUriContext
public Uri? BaseUri { get; set; }

private MdXamlPlugins? _plugins;
public MdXamlPlugins? Plugins
public virtual MdXamlPlugins? Plugins
{
get => _plugins;
set
Expand Down
2 changes: 1 addition & 1 deletion MdXaml/MarkdownScrollViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public string AssetPathRoot
}

private MdXamlPlugins? _plugins;
public MdXamlPlugins? Plugins
public virtual MdXamlPlugins? Plugins
{
set
{
Expand Down
2 changes: 1 addition & 1 deletion MdXaml/MdXaml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<ItemGroup>
<None Remove="EmojiTable.txt" />
<EmbeddedResource Include="EmojiTable.txt" />
<None Include="..\pack_readme\MdXaml.md" Pack="true" PackagePath="\"/>
<None Include="..\pack_readme\MdXaml.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions MdXaml/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

using System.Windows.Markup;

[assembly: XmlnsDefinition("https://github.com/whistyun/MdXaml", "MdXaml")]
17 changes: 17 additions & 0 deletions pack_readme/MdXaml.Full.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Transform Markdown to FlowDocument(WPF).

**How to use**
[How to transform markdown to FlowDocument-object.](https://whistyun.github.io/MdXaml/transform_markdow_to_flowdocument.html)
[How to render markdown in WPF Control.](https://whistyun.github.io/MdXaml/render_markdown_in_control.html)
[for more](https://github.com/whistyun/MdXaml/wiki)

**Migration from Markdown.Xaml**
MdXaml change namespace from Markdown.Xaml to MdXaml. So you should change namespace in your code.
Or use [migration free edition](https://www.nuget.org/packages/MdXaml_migfree/)

**Preview**
![sc1](https://raw.githubusercontent.com/whistyun/MdXaml/master/docs/img.demo/sc1.png)
![sc2](https://raw.githubusercontent.com/whistyun/MdXaml/master/docs/img.demo/sc2.png)
![sc3](https://raw.githubusercontent.com/whistyun/MdXaml/master/docs/img.demo/sc3.png)
![sc4](https://raw.githubusercontent.com/whistyun/MdXaml/master/docs/img.demo/sc4.png)
![sc5](https://raw.githubusercontent.com/whistyun/MdXaml/master/docs/img.demo/sc5.png)

0 comments on commit bf5cba0

Please sign in to comment.