tinymce / tinymce-blazor

Blazor integration
MIT License
45 stars 13 forks source link

How to edit with markdown #38

Closed BeiYinZhiNian closed 2 years ago

BeiYinZhiNian commented 2 years ago

Markdown is supported on the official website, but not in blazor. I don't know how to open it

exalate-issue-sync[bot] commented 2 years ago

Ref: INT-2810

jscasca commented 2 years ago

@BeiYinZhiNian you can achieve markdown behaviour by using the text pattern plugin as documented here: text pattern plugin. How are you passing the Blazor editor your configuration?

jscasca commented 2 years ago

For example:

<TinyMCE.Blazor.Editor Conf="@tpConf" />
@code {
private static object[] textpatterns = new object[] {
        new Dictionary<string, object>{{"start","*" }, {"end","*"}, {"format", "italic"} },
        new Dictionary<string, object>{{"start","**" }, {"end","**"}, {"format", "bold"} },
        new Dictionary<string, object>{{"start","#" }, {"format", "h1"} },
        new Dictionary<string, object>{{"start","##" }, {"format", "h2"} },
        new Dictionary<string, object>{{"start","###" }, {"format", "h3"} },
    };
    private Dictionary<string, object> tpConf = new Dictionary<string, object> { { "plugin", "textpattern" }, { "textpattern_patterns", textpatterns} };
}

Let me know if that helps

BeiYinZhiNian commented 2 years ago

Thanks, it works perfectly