-
Notifications
You must be signed in to change notification settings - Fork 37
How to add a plugin
whistyun edited this page Oct 2, 2022
·
2 revisions
A MdXaml plugin add syntaxes and additional supported image formats. For now, there are two official plugins; MdXaml.Html to add html tag support and MdXaml.Svg to add SVG support.
There are two ways to inject plugins into MdXaml.
The first is described in App.xaml. This applies to all MarkdownScrollViewer
s.
The second is described in MarkdownScrollViewer
or Markdown
. This applies to individual components.
MdXaml.Plugins
is required for custormising plugin. And...
- If you want html support, please add
MdXaml.Html
. - If you want svg support, please add
MdXaml.Svg
.
Add MdXamlPlugins
to Application.Resources
.
Any value can be set for the resource key.
MarkdownScrollViewer
looks for plugins at Application.Resources
and loads them.
App.xaml:
<Application x:Class="***"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mdplug="clr-namespace:MdXaml.Plugins;assembly=MdXaml.Plugins"
xmlns:mdhtml="clr-namespace:MdXaml.Html;assembly=MdXaml.Html"
xmlns:mdsvg="clr-namespace:MdXaml.Svg;assembly=MdXaml.Svg"
StartupUri="***">
<Application.Resources>
<mdplug:MdXamlPlugins x:Key="MdXamlPlugins">
<mdhtml:HtmlPluginSetup/>
<mdsvg:SvgPluginSetup/>
</mdplug:MdXamlPlugins>
</Application.Resources>
</Application>
<!-- xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml" -->
<!-- xmlns:mdplug="clr-namespace:MdXaml.Plugins;assembly=MdXaml" -->
<!-- xmlns:mdhtml="clr-namespace:MdXaml.Html;assembly=MdXaml.Html" -->
<!-- xmlns:mdsvg="clr-namespace:MdXaml.Svg;assembly=MdXaml.Svg" -->
<mdxam:MarkdownScrollViewer>
<mdxam:MarkdownScrollViewer.Plugins>
<mdplug:MdXamlPlugins>
<mdhtml:HtmlPluginSetup/>
<mdsvg:SvgPluginSetup/>
</mdplug:MdXamlPlugins>
</mdxam:MarkdownScrollViewer.Plugins>
</mdxam:MarkdownScrollViewer>