neolithos / NeoMarkdigXaml

Markdig Xaml/Wpf Renderer
Apache License 2.0
32 stars 7 forks source link

Wrong rendering of emphasis and strong emphasis inlines #2

Closed exactamente closed 5 years ago

exactamente commented 5 years ago

According to the CommonMark specification (e.g. the latest one v0.28) "6.4 Emphasis and strong emphasis" the difference between emphasis (rendered in italics) and strong emphasis (rendered in bold) is not only a character but is it single or doubled.

So the single asterisk or the single underscore is emphasis, and doubled asterisk or doubled underscore is strong emphasis.

But EmphasisInlineRenderer in method WriteSpan cares only about delimiter character:

public class EmphasisInlineRenderer : XamlObjectRenderer<EmphasisInline>
{
    private static bool WriteSpan(XamlMarkdownWriter renderer, EmphasisInline span)
    {
        switch (span.DelimiterChar)
        {
            case '*': // bold
                renderer.WriteStartObject(typeof(Bold));
                return true;
            case '_': // italic
                renderer.WriteStartObject(typeof(Italic));
                return true;
            ...
        }
    } // proc WriteSpan
...
}
neolithos commented 5 years ago

Thx. Do you need an update of the nuget packages?

exactamente commented 5 years ago

Yes, please.

neolithos commented 5 years ago

Done.