whistyun / MdXaml

Markdown for WPF - alternate version of Markdown.Xaml
MIT License
245 stars 37 forks source link

Is there a way to turn off specific list markers (question) #56

Closed Tronald closed 1 year ago

Tronald commented 1 year ago

Thank you for such an awesome library.

Is there a way to turn off list markers without modifying the library?

For example I want

1. 2. 3.

but not

A. B. C.

This may be an odd question, but not all Markdown to HTML converters recognize alphabetical and roman numeral lists. Even Github won't recognize it (as you can see the alphabetical list won't be indented in this example).

whistyun commented 1 year ago

Sorry. There is no way to disable extra list markers in the current version. The library has a feature to disable it, but the feature has some problem.

I will fix this problem and add features to disable another extra syntax.

Tronald commented 1 year ago

I appreciate the prompt reply! This project has been extremely helpful.

whistyun commented 1 year ago

apologies for the long delay in fixing this issue. I released v1.18.1.

If you want to disable all enhanced syntax, set Markdown.ScrollViewer.Syntax to Standard. this only enables table and strikethrough syntax.

<!-- xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml" -->
<mdxam:MarkdownScrollViewer
 Syntax="Standard"
 />

If you want to customise enhanced syntax, for example, if you want texttile-inline or table but do not want extra list markers, use the plugin IF.

MyCustomisePlugin.cs

internal class MyCustomisePlugin : MdXaml.Plugins.IPluginSetup
{
    public void Setup(MdXamlPlugins plugins)
    {
        plugins.Syntax.EnableListMarkerExt = false;
        plugins.Syntax.EnableRuleExt = false;
        plugins.Syntax.EnableNoteBlock = false;
    }
}

App.xaml

<Application x:Class="MdXaml.Demo.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:MdXaml.Demo"
             xmlns:mdplugins="clr-namespace:MdXaml.Plugins;assembly=MdXaml.Plugins"
             StartupUri="MainWindow.xaml">

    <Application.Resources>
        <mdplugins:MdXamlPlugins x:Key="MdXamlPlugins">
            <local:MyCustomisePlugin/>
        </mdplugins:MdXamlPlugins>
    </Application.Resources>
</Application>